Using the Excel Set Cell Format VI to Format Numbers in My Excel Report

Updated May 11, 2023

Reported In

Software

  • LabVIEW Full

Issue Details

I am using the Excel Set Cell Format VI to export data from LabVIEW to Excel, but my numbers are not formatted correctly.  I have tried using the LabVIEW string formatting guidelines but my numbers are still being displayed incorrectly in Excel.  What is the correct format for the number format input?

Solution

The Excel Set Cell Format VI follows the Excel number formatting guidelines, not the LabVIEW string formatting guidelines.

Excel guidelines are as follows:
  • # (number sign) -  displays significant digits and does not display insignificant zeros. 
  • 0 (zero) - displays insignificant zeros if the number has fewer digits than there are zeros in the format. 
  • ? (question mark) - adds insignificant zeros on both sides of the decimal point to keep the decimal point aligned.  The question mark can also be used for aligning fractions.
Table 1 shows some examples of basic Excel number formatting described above.  Figure 1 shows how this VI can be used to format the cells in the first 5 rows and 10 columns to always display two decimal places.



 Figure 1: LabVIEW Example that Formats Excel Cells to Always Display Two Decimal Places


Note: To format the cell as text, use @ as the input for number format terminal.