ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   add leading zeros within a formula (https://www.excelbanter.com/excel-worksheet-functions/240413-add-leading-zeros-within-formula.html)

LG[_2_]

add leading zeros within a formula
 
I need to take the zeros from one cell and add them to a forumla in another
cell eq

take 0000000000 (10 zeros) and convert them in the formula to read 0000012345
here is my formula I am using to combine multiple cells

G5&" "&A17&" "&B17&" "&G17&""&F17&" "&F5

The leading zeros are in G17 and the 12345 would be in F17 ...as the formula
stands I get 012345

Jacob Skaria

add leading zeros within a formula
 
Instead use TEXT function
=TEXT(f17,"0000000000")

Or

=G5&" "&A17&" "&B17&" "& TEXT(F17,"0000000000") &" "&F5

If this post helps click Yes
---------------
Jacob Skaria


"LG" wrote:

I need to take the zeros from one cell and add them to a forumla in another
cell eq

take 0000000000 (10 zeros) and convert them in the formula to read 0000012345
here is my formula I am using to combine multiple cells

G5&" "&A17&" "&B17&" "&G17&""&F17&" "&F5

The leading zeros are in G17 and the 12345 would be in F17 ...as the formula
stands I get 012345


T. Valko

add leading zeros within a formula
 
How about this (all on one line):

=G5&" "&A17&" "&B17&" "&
TEXT(F17,"0000000000")
&" "&F5

It eliminates the need for G17 to hold all those 0s.

--
Biff
Microsoft Excel MVP


"LG" wrote in message
...
I need to take the zeros from one cell and add them to a forumla in
another
cell eq

take 0000000000 (10 zeros) and convert them in the formula to read
0000012345
here is my formula I am using to combine multiple cells

G5&" "&A17&" "&B17&" "&G17&""&F17&" "&F5

The leading zeros are in G17 and the 12345 would be in F17 ...as the
formula
stands I get 012345





All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com