Add a comma after certain digits in Excel - excel

I have a column (F) full of 11 digit numbers, what I need is to split them like the following: 12,345,6789,00
I have the following formula which adds a comma after the first two digits however I don't know how to get it to add them in after the next 3 then 4.
=LEFT(F2,2)&","&MID(F2,3,LEN(F2))
The above formula outputs like this: 12,345678900
Any suggestions?

Have you considered using the TEXT function? This is simple and would do the trick:
=TEXT(F2,"00"",""000"",""0000"",""00")

Use MID all the way:
=MID(F2,1,2)&","&MID(F2,3,3)&","&MID(F2,6,4)&","&MID(F2,10,2)

=left(F2,2)&","&mid(F2,3,3)&","&mid(F2,6,4)&","&right(F2,2)
Will give you what you want.

=LEFT(F2,2) &","&MID(F2,3,3)&","&MID(F2,6,4)&","&RIGHT(F2,2)

Try using the Text to Columns function in the Data Tab of Excel. It will allow you to split the numbers based on number of digits. For this to work though, it needs to be the case that the number ALWAYS has 11 digits... otherwise some numbers will get cut in the wrong spot.
You can then Concotenate them back together with Commas inbetween.

Related

Removing first two digits in Excel if the character length is greater than certain number

I have cell phone numbers in Excel some with country code- 91 and some without country code. I need to remove the country code. We have 10 digit phone numbers so I need to remove the first two digits if the character length of the cell is greater than 10, i.e. if I have a number with country code like 917465785236 I need to remove the first two digits- 91 so that I only have 7465785236. I am trying the below piece but it doesn't check the IF condition and removes the first two digits from all the cells. Can someone tell me what's wrong I am doing here:
=IF((LEN(A1>10)),RIGHT(A1, LEN(A1)-2))
You probably need to put the parentheses differently for the Len function:
=IF((LEN(A1)>10),RIGHT(A1, LEN(A1)-2))
You're not using the parenthesis properly. Also since you strictly want to have 10 characters, you don't need to calculated the length in the RIGHT formula.. It needs to be like this:
=IF(LEN(A1)>10,RIGHT(A1, LEN(A1)-2),A1)
Now, that is the issue with your formula, but the solution to your question doesn't even need a IF statement, You can simply use:\
RIGHT(A1,10)
It will automatically get the 10 characters at the end and remove the rest.

How to get rid off only certain zeros formula?

Ok so I had a nice formula until a problem came along. Basically I needed to get rid off a zeros in the middle of a 10 characters String/Range i.e AB00005879 to do that I have used formula SUBSTITUTE(NameRange,"0","") which gave me nice AB5879 solution. Sometimes the number at the end would only be 3 digit long AB00000975 so my formula would give me AB975 All great until I stumble a problem. Some of the strings came in a form of i.e. AB00004020 So my formula extracted every zero leaving me with AB42. Is there a way to extract only first four zeros in a middle an always keep the number at the and? so the last scenario would look like AB4020. Thanks in advance
SUBSTITUTE(NameRange,"0",""))
If you always have two characters at the start and then some zeros and then some numbers, all of which you want to keep, this should work
=LEFT(A1,2) & VALUE(RIGHT(A1,LEN(A1)-2))
EDIT #2
If your string always starts with two letters such as AB following by a random number of zeros and then a number string that you want to keep, try
=LEFT(A1,2)&RIGHT(A1,11-AGGREGATE(15,6,ROW($3:$10)/(--MID(A1,ROW($3:$10),1)>0),1))
Replace A1 with your actual case.

Excel Text to column

Does any of you know if exist any function to split the double brake line to column? I do know how to split by spaces like: =SUBSTITUTE(SUBSTITUTE(B2;CHAR(13);"");CHAR(10);"|"), but I want something like the image bellow:
The solution is depend on your string. If you have only one separation as shown, you can use following equations.
for the 1st part
=LEFT(SUBSTITUTE(A1,CHAR(10),",",1),FIND(",",SUBSTITUTE(A1,CHAR(10),",",1),1)-1)
for the 2nd part
=MID(SUBSTITUTE(A1,CHAR(10),",",1),FIND(",",SUBSTITUTE(A1,CHAR(10),",",1),1)+1,10000)
This is independent from the number of consecutive char(10) characters between text.
Just use two different formulas, there are many ways you could go about it. Say something like =LEFT(A1,FIND(CHAR(10),A1)) for the first column and =RIGHT(A1,LEN(A1)-SEARCH(CHAR(10),A1)) for the second one.

How to remove 1 character from a column in excel

I have a column in my Excel file which contains different values. All these values begin with a letter and continues with a number.
I would like to know how to remove that letter and obtain only the number. Keep in mind that each value can have a different length.
Thanks
You can use something like this
=MID(A1,2,LEN(A1)-1)
you could do it with
=SUBSTITUTE(A1,LEFT(A1),"")
or
=RIGHT(A1,LEN(A1)-1)
There are countless ways to do that...
use simple function in excel itself
=left(cellname,no. of charcters)
=left(A1,8) will give only first left characters and same can be used right/mid

Excel Number Formatting

I'm currently working on a sheet that contains part numbers in it. I'd like them to be formatted like this:
####-#####-XX
Where #s can be letters or numbers, #s are numbers, and Xs are letters.
I run into two problems while doing this. The first is that I can't figure out how to handle text and numbers at the same time in the Custom Format dialog box. The second is that occasionally a part number will have 3 letters after the second hyphen rather than 2, and I can't figure out how I should structure the condition to differentiate between the two formats.
How can I handle numbers and text at the same time when creating a custom format, and how can I add the condition described above (based on character numbers or something)?
Thanks.
If can't be achieved with custom formatting then a formula such as below may suit:
=LEFT(A1,4)&"-"&MID(A1,5,5)&"-"&RIGHT(A1,LEN(A1)-9)
If the middle number section has to be 5 digits, use
#-0000#-XX
But I don't think number formats are designed to handle Alphanumeric entries, and I can't help you with those X's

Resources