How to keep leading zero and add comma in openoffice calc formula?

user1367204 picture user1367204 · May 31, 2012 · Viewed 10.8k times · Source

I have 6 fields in a row in open office, the 1st is a word, the 2nd, 3rd, and 4th are a number with a leading zero, the 5th and 6th are regular numbers. How do I join them all together with a comma between them so that the leading zero stays?

Answer

Excellll picture Excellll · May 31, 2012

Based on your comment about your numbers having a leading 0 in virtue of a custom number format, you need to incorporate TEXT() functions into your formula to retain (i.e., add) your leading 0s.

=CONCATENATE(A1,",",TEXT(B1,"0#####"),",",TEXT(C1,"0#####"),",",TEXT(D1,"0#####"),",",E1,",",F1)

Just be sure to include as many #'s as the max length of a number in that field.