Major noob here. This is my dilemma:
I created a spreadsheet on excel and input my data in a column. Then I was informed that I need to add two zeros (00) to the front of each value. Is there a way of doing this on excel w/o me double clicking each row and manually adding the 00's before the original value?
in order to add two leading zeros to numbers of unknown length, the only viable option I can think of is to turn the number into a string.
="00"&A1
There may be a way with the format text function to measure the length of your number then format with two leading zeros but that is currently beyond me.
The other option is to go into the custom cell format and change the display to
000000
Where the number of 0s is two longer than the number of digits in your number. If your numbers are inconsistent in length you would need to do this for each cell. It would keep the number as a number though.
Thanks for your replies. #Forward Ed your idea gave me a diff idea. I just added the 00's to the column before and then used another column + the CONCATENATE function.
Also for fellow cavemen like myself, you can use notepad to do it the ghetto way and copy then re-paste back to excel -.-
Im such an idiot lol. Thank you
Related
I have multiple excel columns filled with serial numbers from different overlapping databases Im trying to compile them all and remove overlapping numbers to create a unified data base. I've had success using excel formulas to compare the lists to remove duplicates. however the last issue that is one of the lists I'm pulling from has added "0", "00", or "000" in front of some but not all of its serial numbers. Which threw off my comparison and left some duplicates. the list is too long for me to go over manually or even with control + F. Is there a formula I could use to remove starting 0s? I dont mind if i have to use it 3 times. or if you have a different solution I'm all ears. Thanks for any help. I'm horrible with excel.
Are all the serial numbers supposed to be the same length?
If they are same length, say length x, you can remove leading zeroes with formula =RIGHT( [serial number], x)
Assuming you have no more than 3 0s at the start of the serial numbers you could use the following formula:
=CHOOSE((--(LEFT(A1,1)="0"))+(--(LEFT(A1,2)="00"))+(--(LEFT(A1,3)="000")+1),A1, RIGHT(A1,LEN(A1)-1), RIGHT(A1,LEN(A1)-2), RIGHT(A1,LEN(A1)-3))
(where A1 is the cell with the serial number)
NUMBERVALUE should do the trick
I want to give a two-column Excel file as input to my script. But I need a two-column Excel file to have one feature: the second column must have 10 characters. Because the number of rows in the Excel file is large, I can not manually edit every cell in the second column.
So I need to put a control function in Excel to check the second column, so that it counts the number of characters in each cell in the second column and adds zero to the right of it, which is less than ten characters.
Based on my search, I realized that I could use the definition of the condition and the Len function, but the output was not what I wanted.
Full ID Expected Result
15 0000000015
159 0000000159
16 0000000016
43 0000000043
4329 0000004329
What I had tried :
=Right(A2,LEN(A2)+8)
but it was wrong.
How can I get my expected results in like the top example?
One way is to use Rept to repeat the correct number of zeroes:
=REPT("0",10-LEN(A2))&A2
Or simpler to use Text:
=TEXT(A2,"0000000000")
The nearest to your original formula would be something like
=LEFT("0000000000",10-LEN(A2))&A2
Or better the formula suggested by #JvdV
=RIGHT("0000000000"&A2,10)
To be honest I wasn't sure if by simply formatting the data as "0000000000" the zeroes would be preserved if (for example) you wrote the sheet out as a CSV, but I have tested it just to make sure and in fact they are so I think this remains the optimal solution.
Test Sheet
Resulting CSV
How could i split a number on this format: xxxxxxxx to this xxxx-xxxx in excel?
I would like to start by stating that I believe Ron Rosenfeld's comment to be absolutely correct. Adding a dash to the number does two things:
Changes it from being a number to being text
Increases the amount of information that needs to be stored
you are usually far better off changing the display formatting than actually inserting the dash/hyphen between the first and last 4 digits.
Having said that, if you have a reason to actually insert the dash, you can use the following formula assuming your Data is in A1. Place the formula in your required cell and copy down as necessary:
=LEFT(A1,4)&"-"&RIGHT(A1,4)
I have a list of numbers for a client like below:
8481.80.9005
8481.80.9005
8413309090
8413309090
The first two numbers exhibit the correct formatting, per the client. Is there a formula and/or custom formatting that I can use to make all numbers uniformly the correct format?
Note - all numbers are 10 digits with periods after the fourth and sixth digits.
I know I'm going to be shot down on this one, but couldn't see why you can't do
0000\.00\.0000
in custom formatting
The problem with a custom format is that Excel will read the number as a whole number and any attempt at putting in the ., if your local settings are set to the . being the decimal separator, is that it will try to put it at the end.
So we need to first make it a string with some other separator and then do a substitute.
The following formula does that:
=SUBSTITUTE(TEXT(A1,"0000-00-0000"),"-",".")
When numbers are stored as text in Excel you see this little guy http://imgur.com/zXdwD
in the upper-left hand corner. when you click on it it gives you the option of converting the text representation of a number to a number upon which math can be done. also, when stored as text numbers appear on the left side of the cell opposed to the right one. I have an array of numbers which are stored as text, but they don't offer that little green thing to convert them to numbers. It may sound trivial but I'm using the Vlookup function to reference a large column of numbers to a code name, but it's not being recognized. And the only thing I can think of is that it's somehow being read differently (the codes are most defintely in the lookup table, and ctrl+f will find them). I want to know if anyone has an idea about what's happening.
Thanks.
The smart tag is a little finicky at times. There's a couple of things you can do.
If you're using code, you can multiply the cells in the range by 1, this will convert them to a number.
Alternatively you can convert the number you're matching to a string and then vlookup. Something similar to:
=VLOOKUP(TEXT(A1,"#"),B1:D10,2,false)
Note TEXT(A1,"#") would round to no decimal places, you may have to adjust the formatting.
The format of some of the cells in the lookup table maybe formatted as text. If there are a lot of them you can create a macro that corrects them. I had the same issue in this SO question although it was the opposite problem.
Another way to correct them would be to copy all the cells in the lookup table in that column and in an adjacent blank column edit>paste special>values>add which makes each of them numeric. Then copy them and paste those back over the originating cells.
A quick trick to convert all numbers formatted as text back to umber format is to copy the data into the "Notepad" application. Then select and copy the data from "Notepad back into your spread sheet and everything will be converted to number format.