Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Excel Custom Number Format Import

Hi all

my question is: Is there a way I can import this custom number format to qlikview ?

format.PNG

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

One solution could be to:

1) Copy the Excel-file to a temporary file folder

2) Open the copied Excel-file

3) Run a tiny VBScript macro that copies the format values to an adjoining column

4) Save the Excel-file

5) Read it from QlikView load script.

Another solution could be:

1) Run a tiny VBScript macro to copy the format values (all of them) into a QlikView variable in the load script

2) Access the format for a particular value either in the load script or later in an expression in a chart.

    SubField()-function can be used in both cases.

The Macro/Module VBScript for the second solution would look like this:

2017-01-22 01_12_05-Edit Module.png

And using this VBScript function from a load scxript would be to simply use it like this and assign the return value to a QlikView variable:

2017-01-22 01_13_00-Edit Script [C__Users_psd_Documents_JiveJSON2.qvw_].png

You can pick the value you want like this:

SubField( allNumberFormats , Chr(13) & Chr(10) , 59 )     // To get the 59th NumberFormat

Just displayed in a Text Box in QlikView they would look like this:

2017-01-22 01_16_11-QlikView x64 - [C__Users_psd_Documents_JiveJSON2.qvw_].png

View solution in original post

4 Replies
petter
Partner - Champion III
Partner - Champion III

Yes you can

You can use the Num# function in your LOAD statement in the load script:

     Num#( fieldnameA ,'#,##0 ST')

Anonymous
Not applicable
Author

Thanks for your reply.

Unfortunately, re-formating the imported number is not what I am after.

What I need is a way to read the number format that is specified in the Excel custom number format, not (only) the actual value of the field.
The reason is that the field contains numeric values, but each row has a different excel number format, which for me is information.

For instance, in the same field, there are some rows that have this format:
#,##0, "ST"

while others have

#,##0, "L"

...and then a few more different formats.

Is there a way to do read the format in the script?

(Excel file can't be altered, there is no other column that gives away what format my column would contain)

petter
Partner - Champion III
Partner - Champion III

So what do you want to do with these different formats once you have read them? I guess just reading the formats alone will not be of much value. Using them together with the numbers that are formatted according to that would probably be a goal then?

Do you have a part of a spreadsheet that you could share with a more extensive explanation? That way we won't waste yours or ours time.

By creating an Excel VBA macro you can easily extract any numberformat out of a spreadsheet and determine exactly which values that are using them...

petter
Partner - Champion III
Partner - Champion III

One solution could be to:

1) Copy the Excel-file to a temporary file folder

2) Open the copied Excel-file

3) Run a tiny VBScript macro that copies the format values to an adjoining column

4) Save the Excel-file

5) Read it from QlikView load script.

Another solution could be:

1) Run a tiny VBScript macro to copy the format values (all of them) into a QlikView variable in the load script

2) Access the format for a particular value either in the load script or later in an expression in a chart.

    SubField()-function can be used in both cases.

The Macro/Module VBScript for the second solution would look like this:

2017-01-22 01_12_05-Edit Module.png

And using this VBScript function from a load scxript would be to simply use it like this and assign the return value to a QlikView variable:

2017-01-22 01_13_00-Edit Script [C__Users_psd_Documents_JiveJSON2.qvw_].png

You can pick the value you want like this:

SubField( allNumberFormats , Chr(13) & Chr(10) , 59 )     // To get the 59th NumberFormat

Just displayed in a Text Box in QlikView they would look like this:

2017-01-22 01_16_11-QlikView x64 - [C__Users_psd_Documents_JiveJSON2.qvw_].png