Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
posywang
Creator
Creator

Number Format Issue

I have attached a sample file for this question. We tried Round and Num function but neither works as desired. We'd like to allow users to control the display of decimal places and keep the format once sending to excel. When using Round, format is kept when sending to excel. However, it shows 11.8 instead of 11.80 when user selects two decimal places. When using Num, it shows decimal places correctly in the table, but format is lost when sending to excel. We can see that some data is exploded to four decimal places. We've been stuck in this issue for a couple of weeks now and would like to ask for suggestion from this forum.Thank you!

8 Replies
Anonymous
Not applicable

=num#(If(vNbrFormat = 'Millions',  num(Avg(F2)/1000000,'#,##$(vDecimal2)'), If(vNbrFormat = 'Thousands', num(Avg(F2)/1000,'#,##$(vDecimal2)'), num(Avg(F2),'#,##$(vDecimal2)'))),'#,##$(vDecimal2)')

posywang
Creator
Creator
Author

Looks like we are one step closer to the solution! Below is what I got from Sending to Excel. Is there a way to keep the two decimal places in Excel? Thanks.

   

F1Avg
42174.03
a40000.12
i20000.02
j35000.1
m40000.21
n37500.1
o50000.19
r50000.07
s50000.12
v70000.12
w80000.2
y10000.22
Anonymous
Not applicable

using num# kept the 2 decimal places for me.  looking at vDecimal2

=num#(If(vNbrFormat = 'Millions',  num(Avg(F2)/1000000,'#,##$(vDecimal2)'), If(vNbrFormat = 'Thousands', num(Avg(F2)/1000,'#,##$(vDecimal2)'), num(Avg(F2),'#,##$(vDecimal2)'))),'#,##$(vDecimal2)')

is that not what you got?

RSvebeck
Specialist
Specialist

You might find some hidden Easter egg settings usefull. 


Search "Easter Egg" in the forum.


or this link may work as a start:


https://community.qlik.com/mobile/mobile-redirect.jspa?nativeURL=jivecore%3A%2F%2Fcontents%2F365464%...


Robert


Svebeck Consulting AB
posywang
Creator
Creator
Author

I used your file and this is what I got in Excel. Is there any configuration that I need to do in my Qlikview application to get the same result?

F1Avg(in Thoousands)
42.17
a40
i20
j35
m40
n37.5
o50
r50
s50
v70
w80
y10
posywang
Creator
Creator
Author

I did update one Easter Egg setting - ExcelExportMixedAsText ->Set it to '0' per users request. They couldn't add up Text in Excel.

Anonymous
Not applicable

That would be why.  I don't think you're going to be able to force it from Qlikview without sending it to Excel as text or using an external extension like Nprinting.

Excel is formatting as 'General' which automatically drops any zeroes at the end.

If you do find a way, please post it!

RSvebeck
Specialist
Specialist

This formula works for Me when exporting to Excel.

=num(

round(num#(10*(num#(1&repeat(0,vDecimals))))*num#(Value),1)/num#(10*(num#(1&repeat(0,vDecimals))))

,'#,'&repeat('#',vDecimals),'')

The vDecimals is a variable -  containing  a digit defining how many decimals excel should receive. Set it for example to 4, and excel will get 10.0002, or set it to 2 and excel will get 10.00 for the same value.

Adjust . and , depending on your regional settings.

Replace "Value" with your function as you have it in your application.

Good Luck

Robert

Svebeck Consulting AB