Leading Zeros To Complete 3 Digit Number

jgthtrotih

Well-known Member
Joined
Aug 28, 2009
Messages
568
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Hey All

i need a little help with leading zeros in excel i want a complete 3 digit number as shown blow (first chart) i used the " ' " mark to get the zeros in..i want the second chart to look the same with the zeros...

Chart 1: Examples and what I'm trying to get Achieve.
Chart 2: My actual data set.
Excel Workbook
EF
28RANDBETWEEN("000",999)
29
30
31356356
32454454
3348048
34367367
35785785
3646046
37856856
38986986
3946046
4085085
418008
Sheet


Excel Workbook
EFGHIJKLM
784019348-401-934
8
945058716450-587-16
Sheet14


Have Any Questions Let Me Know!

Using Excel 2003!

Thanks!
 
OK, if this is your formula in K7
=IF(E7="","000-000-000",E7&"-"&G7&"-"&I7)

But you want the 3 numbers to be in 3 digit format right?
You have to apply the Text function to each part of the number (E7 G7 and I7)

Try
=TEXT(E7,"000-")&TEXT(G7,"000-")&TEXT(I7,"000")
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Jonmo1,

*Keep Original Cell References These Are Example Cell References*

That is close to what I'm after..leme try it this way...

If 436 is Entered in Cell E31
If 005 is Entered in Cell G31
If 055 is Entered in Cell I31

Than it would come together in K31

if the next set of numbers are the same..nothing happens...i dont want duplicate sets of numbers.

If the next set of number are entered as followed than it would come together in cell K32

If 234 is Entered in Cell E31
If 256 is Entered in Cell G31
If 672 is Entered in Cell I31
if the next set of number are entered as followed than it would come together in cell K32..and so on as "Exampled" below
Excel Workbook
CDEFGHIJKLMNO
30
31436005055436-005-055
32234-256-672
33264-986-234
34975-468-246
35906-869-969
36486-960-894
37057-996-473
38696-896-689
39696-590-378
40
Sheet14


Please ask any further questions

Formula are preferred.

Thanks!
 
Upvote 0
Please help read post 12.

Thanks!

It looks like jonmo1 got what you need except you don't what any duplicates.

Why not try a macro approach. Now I'm no expert so I just recorded the following code to remove the formula in K31:K40 so advanced filter could remove the duplicates and place it in N31:N40. Feel free to change the range as you need:

Code:
Sub removeduplicates()
    'removes formulas which basically does a paste special values only'
    Range("K31:K40").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    
    'removes duplicates and places it in column N'
    Range("K31:K40").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
        "N31:N40"), Unique:=True
End Sub
 
Upvote 0
Hi

If I understand correctly, you will be entering numbers in only 3 cells (E31, G31 & I31 via formula).

Every time the formula is re-calculated you want to populate Column K starting from K31. You don't want to populate Column K if the 3 numbers have already occurred. Am I right?

If yes then you will need to use a Worksheet Calculate event to do this.
 
Upvote 0
Sandeep,

Yes..exactly what i was looking for...how would i go about setting the code up?..as I'm not good with the "Code Road"...i like "formula Street" better less bumpy.

mrnacar,

Couldn't get it to work.

Thanks!
 
Upvote 0
Does number order matter while checking for duplication?

For example: if 431, 005, 010 have already occurred, you will get 431-005-010.... now if a new lot of numbers say 010, 431, 005... is this counted as a duplicate (since all 3 numbers have already occurred) or new (since order of occurrence is different)?
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

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