LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set an Excel cell format to text?

I am using LabVIEW 8.2.1 with the report generation addon. I have a number that represents a relative time that I would like to display in minutes and seconds in Excel. As I was unable to find a way to programatically do that, I tried the next best thing. I did the conversion in LabVIEW so that I created a string that was in the format 00:00, and sent it to Excel. This worked great most of the time, but then I had a time of 29:29. Excel automatically formatted it as 29:29:00, which is vastly different from what was intended. I kept looking at the Excel Set Cell Format icon, but could not figure out how to get it to perform the desired function. Is there a way to send Excel a number representing a relative time and have it display in minutes and seconds, or is there a way to display a string without it trying to force it into the 00:00:00 format?

 

Thank you!

0 Kudos
Message 1 of 4
(5,802 Views)
This is a frequently asked question. Excel uses a different starting time than LabVIEW. In order for a numerical value of time in LabVIEW to be shown correctly in Excel you have to offset it. I believe the offset is 4 years, or something like that. Just do a search on "Excel time" on these forums. You'll come across lots of hits.
Message 2 of 4
(5,792 Views)
Within Excel it's definitely possible to format a cell as mm:ss - have you tried using that as an input to Excel Set Cell Format?  Alternatively, you can preface any string with a ' in Excel to force it to treat that string as text, rather than interpret it as a number or formula.
Message 3 of 4
(5,778 Views)
The ' preceding the string did the trick! Thank you so much! I also learned a great deal reading the dozens of posts related to Excel time. Problem solved!
0 Kudos
Message 4 of 4
(5,725 Views)