Leading Zero iwith Concat

allieanne

New Member
Joined
Jan 19, 2009
Messages
12
I've got two columns, department and position. I want to smush them together into one in order to use vlookup from another sheet.

The position number needs to be 3 digits long in the final product. I have 1,2, and 3 digit position numbers. I can of course make it show the leading zeros using formatting, but when I concat it drops the zeros. I need the result to be 111-001 not 111-1. There's all sorts of manipulations I could do to make this work, but wondering if there is a simple way that I'm overlooking?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Use the TEXT function, i.e.
Code:
=TEXT(A1,"000") & "-" & TEXT(B1,"000")
 
Last edited:
Upvote 0
I would normally recommend formatting the position column.

Highlight the column, right click, "Format Cells..." , "Number Tab", Category = "Custom" , Type "000" (without quotes).


Dunno if there is an easier solution than that.

Edit: Doesn't meet requirements for Vlookup - See #4
 
Last edited:
Upvote 0
I would normally recommend formatting the position column.

Highlight the column, right click, "Format Cells..." , "Number Tab", Category = "Custom" , Type "000".
Formatting the column does not change the underlying value, just the way it is presented to the user.
In order for the VLOOKUP to work, you MUST update the underlying result, like I showed in the previous response.
 
Upvote 0
If you prefer to use CONCATENATE, you would do it like this:
Code:
=CONCATENATE(TEXT(A1,"000"),"-",TEXT(B1,"000"))
I prefer the first method I posted, as it is less typing!;)
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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