Concatenate without losing leading zeroes?

paquirl

Board Regular
Joined
Oct 12, 2010
Messages
226
Office Version
  1. 2016
Platform
  1. Windows
Column A has numbers that should all be 6 digits. Some have leading zero(es).
Column B has numbers that should all be 5 digits. Some have leading zero(es).
Column C should combine both A and B with every cell having an 11 digit number.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Try:
VBA Code:
=TEXT(A1,"000000") & TEXT(B1,"00000")
for an entry in row 1.
 
Upvote 0
Solution
I used as a formula in C1 and it is giving me an invalid name error. Says the formula contains unrecognizable text.
 
Upvote 0
I used as a formula in C1 and it is giving me an invalid name error. Says the formula contains unrecognizable text.
The TEXT function has been around forever in Excel, so that should not cause any issues.

Which version of Excel are you using? If a European version, you may need to use semi-colons instead of commas, i.e.
Excel Formula:
=TEXT(A1;"000000") & TEXT(B1;"00000")

You aren't doing this in Google Sheets, by chance, are you?
 
Upvote 0
Using 2016, standard US version , no Google sheets.
 
Upvote 0
Using 2016, standard US version , no Google sheets.
There is nothing in that formula that should cause any issues.
Did you copy and paste it in directly, or did your try to re-type it yourself?

What exactly is in cells A1 and B1 (please post examples)?
Are they hard-coded, or are they the result of formulas?
If formulas, please post those formulas.
 
Upvote 0
ok i see something odd, this particular spreadsheet (sent to me by a colleague) has numbers for column headers instead of the letters.
 
Upvote 0
Sounds like it's using R1C1 notation, in which case try
Excel Formula:
=TEXT(RC[-2],"000000") & TEXT(RC[-1],"00000")
 
Upvote 0
ok i see something odd, this particular spreadsheet (sent to me by a colleague) has numbers for column headers instead of the letters.
Ah yes.
The devil is often in the important details left out!
 
Upvote 0
it wont let me select both formulas as the solution to this thread :(
 
Upvote 0

Forum statistics

Threads
1,214,412
Messages
6,119,369
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top