Custom Cell Format (Should be an easy one!)

markf5998

Board Regular
Joined
Jan 13, 2011
Messages
103
I have a =concatenate() formula that pulls together 3 different cell values seperated by a hyphen. The result is always numeric, in the format 00000-000-00000.

My problem is that if the number in the center has leading zeroes, they are automatically removed. I tried applying a custom format to the cell (00000-000-00000), but it isn't working.

=CONCATENATE(VLOOKUP($C$47,'Buy Summary'!$A$6:$P$55,8,FALSE),"-",VLOOKUP($C$47,'Buy Summary'!$A$6:$P$55,16,FALSE),"-",B13)

Any help would be greatly appreciated!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi Mark,

Something like this will hold the formatting, just change my cell references with your references or formula.

=TEXT(A1,"00000")&"-"&TEXT(B1,"000")&"-"&TEXT(C1,"00000")
 
Last edited:
Upvote 0
Perhaps replace
Code:
VLOOKUP($C$47,'Buy Summary'!$A$6:$P$55,16,FALSE)

with something like this (not tested, you may need to play around with it)
Code:
TEXT(VLOOKUP($C$47,'Buy Summary'!$A$6:$P$55,16,FALSE),"000")

Edit to add - sorry, FAR too slow :-)
 
Upvote 0
Here's a quick data Table (on Sheet1):
Excel Workbook
ABCDEF
1Company 112345Company 145Company 16789
2Company 23Company 2321Company 26
3Company 39Company 3132Company 37
4Company 46Company 4Company 442
5Company 52Company 523Company 5312
6Company 64Company 6Company 6456
7Company 78Company 7534Company 776
Sheet1
Excel 2007
Cell Formulas
RangeFormula
D4=IF(ISNA(VLOOKUP(A4,$E$1:$F$3,2,0)),"",VLOOKUP(A4,$E$1:$F$3,2,0))
D6=IF(ISNA(VLOOKUP(A6,$E$1:$F$3,2,0)),"",VLOOKUP(A6,$E$1:$F$3,2,0))
C1=IF(ISNA(VLOOKUP(A1,$E$1:$F$3,1,0)),"",VLOOKUP(A1,$E$1:$F$3,1,0))
C2=A2
C3=A3
C4=A4
C5=A5
C6=A6
C7=A7
E2=C2
E3=C3
E4=C4
E5=C5
E6=C6
E7=C7


Then here on Sheet2 - I want to Concatenate 3 fields, based on my Lookup Value
Company 1 ( In cell B1) - Note Formula in Cell B3

Hope that Helps...
Excel Workbook
AB
1Look up Value -->>Company 1
2
312345-045-06789
Sheet2
Excel 2007
Cell Formulas
RangeFormula
B3=CONCATENATE(TEXT(VLOOKUP($B$1,Sheet1!$A$1:$F$7,2,FALSE),"00000-"),TEXT(VLOOKUP(Sheet2!$B$1,Sheet1!$A$1:$F$7,4,FALSE),"000-"),TEXT(VLOOKUP($B$1,Sheet1!$A$1:$F$7,6,FALSE),"00000"))
 
Upvote 0
PS-- The formulas shown for Sheet1 are insignificant (they are carry overs from a file I used to build this sample)

Jim
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

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