Awkward concatenating problem

mcornbill

Board Regular
Joined
Aug 24, 2005
Messages
79
Hi all

Probably a simple answer to this one. I have 3 cells of data which I want to concatenate. However one of the cells is in a custom format which is padding out any values in it with leading zeroes to make it 12 characters in length. E.g:

567.78 becomes 000000567.78
3.20 becomes 000000003.20
etc etc

When this cell is concatenated it loses it's leading zero formatting. I've tried everything I can think of but short of actually typing the numbers manually using an ' at the beginning, I'm stumped!

Cheers
Mark
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
couple ways to do it...

=REPT(0,12-LEN(A1))&A1
or
=Right("000000000000" &A1,12)
 
Upvote 0
Cheers jonmo

Close, but doesn't quite do what I need it to. My value field are all 12 digits long now but if the original value happened to be 54.00 it turns it into 000000000054, rather than 000000054.00 If the value happened to be 54.20 it turns it into 00000000054.2, rather than 000000054.20. So excel is discarding any decimals it thinks it doesn't need and then putting extra zeroes at the front of the string to make it 12 characters. Normally this would be fine but this file is for a BACS run which takes fixed widths out of the string I'm concatenating, so the last 2 digits have to be pence even if it is 0 pence.

Hmmmmmmm........
 
Upvote 0
Try this.

=TEXT(A1, "0000000000.00")
 
Upvote 0
=RIGHT("000000000000" &TEXT(A1,"00.00"),12)
=REPT(0,12-LEN(TEXT(A1,"00.00")))&TEXT(A1,"00.00")


edited...

I like Nories better. Way simpler. Wierd that I thought to use the Text function to account for decimals...but couldn't put it any further than that...LOL. :oops:
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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