# Excel 2003: Formula to get 4 digits

#### cepes

##### New Member
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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

##### MrExcel MVP
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)

#### DonkeyOte

##### MrExcel MVP
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

#### cepes

##### New Member
=RIGHT("0000"&A1,4) works perfectly!! Thank you-

#### cepes

##### New Member
Hi again:
A co-worker came up with this one too:

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

Replies
4
Views
118
Replies
10
Views
198
Replies
2
Views
31
Replies
3
Views
421
Replies
3
Views
528

1,191,484
Messages
5,986,854
Members
440,053
Latest member
jhollingworth

### 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?

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