Excel 2003: Formula to get 4 digits

cepes

New Member
Joined
Oct 28, 2005
Messages
29
Hi:
I need each cell to have 4 digits. For example, Cell A1 should have 4 digits

If number of Cell A1 digits < 4, add a zero to the front of the digits, otherwise leave alone.

So, if A1 = 292 would become 0292

Also, I guess if A1 = 92, it should become 0092

Thanks!

Charlie
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
hi:
I Need Each Cell To Have 4 Digits. For Example, Cell A1 Should Have 4 Digits

If Number Of Cell A1 Digits < 4, Add A Zero To The Front Of The Digits, Otherwise Leave Alone.

So, If A1 = 292 Would Become 0292

Also, I Guess If A1 = 92, It Should Become 0092

Thanks!

Charlie

Try...

B1:

=RIGHT("0000"&A1,4)
 
Upvote 0
if it's purely a display issue format the cells using custom format of "0000"... 1 will show as 0001 but is still effectively 1
 
Upvote 0
Hi again:
A co-worker came up with this one too:

=IF(A1>9999,A1,RIGHT("0000"&A1,4))
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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