How can I Count to see if the amount of Characters in a cell is odd and if it is, add a 0 to the front of the cell

popcornrulez

New Member
Joined
Mar 15, 2013
Messages
35
So lets say that the cell A1 has the number 900 in it. What I want to do is put a formula in B1 that checks to see if A1's character count is odd and if it is odd, then add a 0 in front of the original number from A1. Here's an example.

COLUMN A COLUMN B
ROW 1 900 0900


popcornrulez
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
If you want to display 4 digits and retain the cell value as a number, use Format Cells - Number Tab - Custom - and type in 0000 in the box underneath Type (on the right side of the screen).

If you want to convert the numeric numbers to text, use this formula: =TEXT(A1,"0000")

Let me know if you're looking for something else because a formula for your specific request to add a 0 in front of an odd length number would result in the number 7 becoming 07, but I suspect you're looking for 0007.
 
Upvote 0
So lets say that the cell A1 has the number 900 in it. What I want to do is put a formula in B1 that checks to see if A1's character count is odd and if it is odd, then add a 0 in front of the original number from A1. Here's an example.

COLUMN A COLUMN B
ROW 1 900 0900







popcornrulez
Excel Workbook
AB
19000900
Sheet5
 
Upvote 0
Thanks JoeMo that works for what I was trying to do. As for Ron, I needed this formula to work for any amount of digits, not just four.


popcornrulez
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,897
Members
449,097
Latest member
dbomb1414

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