From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Easy table.vi returns wrong number format and rounds off.

Solved!
Go to solution

I changed the VI to the one I'm actually using.

I think the subject line says it all. Here's my data collected from a test instrument.

Capture.PNGHere's what I get in Excel.

Capture2.PNG

0 Kudos
Message 1 of 12
(3,924 Views)

It is just the way it is displayed in Excel, if you click on a cell and look in the formula bar you will see the real value. You can change the way Excel displays the data using the Excel Set Cell Format.vi.

 

Ben64

0 Kudos
Message 2 of 12
(3,880 Views)
Solution
Accepted by topic author RHutchings

@ben64 wrote:

It is just the way it is displayed in Excel, if you click on a cell and look in the formula bar you will see the real value.


Unfortunately, at least in LabVIEW 2016, this isn't correct.  LabVIEW takes a perfectly good polymorphic function (Excel Easy Table), accepts the Dbl format, but then internally hands it to a function called "Append Numeric Table to Report (wrap)" that includes an (unwired) Format String, %.3f, that limits you to three decimal places.  You really do lose the precision [I just "did the experiment" to prove it to myself, but will leave as an "Exercise for the Reader" if changing the Cell format changes this behavior].

 

Bob Schor

 

Aha!  Solved it.  Don't use "Excel Easy Table", but instead use "Append Table to Report", which (as it turns out) is the function that Easy Table calls, but now you can specify %6.3f as the Format you want and get the Excel appearance you desire.  It still isn't saving Dbls (why not?), but you can at least control the Precision.

 

BS

 

Message 3 of 12
(3,866 Views)

@Bob_Schor wrote:

@ben64 wrote:

It is just the way it is displayed in Excel, if you click on a cell and look in the formula bar you will see the real value.


Unfortunately, at least in LabVIEW 2016, this isn't correct.  LabVIEW takes a perfectly good polymorphic function (Excel Easy Table), accepts the Dbl format, but then internally hands it to a function called "Append Numeric Table to Report (wrap)" that includes an (unwired) Format String, %.3f, that limits you to three decimal places.  You really do lose the precision [I just "did the experiment" to prove it to myself, but will leave as an "Exercise for the Reader" if changing the Cell format changes this behavior].

 

Bob Schor

 

 


That's terrible!!! I don't have the time to try but I wonder if saving the data as a string table and then changing the cell format in Excel would be possible.

 

Ben64

0 Kudos
Message 4 of 12
(3,863 Views)

Ben,

 

     I was editing my reply as you were responding to it.  It's partly solvable, but still a kludge.

 

Bob Schor

0 Kudos
Message 5 of 12
(3,861 Views)

I want to try the Append Table to Report but I don't know how to build MS Office parameters. Help!

0 Kudos
Message 6 of 12
(3,835 Views)

It is not clear (to me) why you need to worry about the MS Office Parameters.  Why don't you put together a small VI that shows what you are trying to do (and if you are unsure how to do something, put a Text Label in there that says what you want to do).  Seeing actual code, with inputs, outputs, etc., makes it much easier for "non-mind-readers" such as myself to better understand what you want to do and where you might be going astray.  I can pretty much guarantee one of us will respond within a few hours.

 

Bob Schor

0 Kudos
Message 7 of 12
(3,824 Views)

Capture2.PNGOK so I got something for that but I'm getting this error when I run it. I'm including a piece of the VI. In the end, I need to collect data from an instrument, insert it into a spreadsheet, take another set of dat and insert into the same Excel sheet at the new location next to the previous data. I had everything work except the data being rounded.Capture.PNGHere's

0 Kudos
Message 8 of 12
(3,823 Views)

Since you provide row and column position connect empty string constants to the name and bookmark inputs.

Ben64

0 Kudos
Message 9 of 12
(3,811 Views)

Tried that and got this.Capture.JPG

0 Kudos
Message 10 of 12
(3,807 Views)