VBA - numeric to text

KG Old Wolf

Board Regular
Joined
Sep 20, 2009
Messages
65
This must be simple but it eludes me.

I have a set of values 0 to 99 that I need to append as a two character string to an existing string. I can go through an "if" routine that checks and then functions but it seems like "too much cure for too little sickness".

Isn't there some easy one or two line conversion to take the value 1 and append it to a string as "01"?


Thanks
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try like this

=A1&TEXT(B1,"00")

where A1 contains a text string and B1 contains a number.
 
Upvote 0
Instead of IFs, you may use this TEXT function as below:

=TEXT(a1,"00")
 
Upvote 0
Thanks you both - I was unaware of the format abilities within the TEXT command... makes so much sense
 
Upvote 0

Forum statistics

Threads
1,215,488
Messages
6,125,092
Members
449,206
Latest member
ralemanygarcia

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