Excel Number Formatting - excel

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

Related

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.

Extracting certain numbers from a cell containing numbers and special characters

I have cells that contain both numbers and special characters such as this:
[1:250:10]
The 'coordinates' shown above can be in the following format.
[(1-9):(1-499):(1-15)] in terms of what numbers can be within each part.
How do I extract these three numbers into three separate cells?
Assuming your data is in Cell A1 the to extract first number use following formula
=MID(A1,2,(FIND(":",A1,1)-2))
for second number use
=SUBSTITUTE(MID(SUBSTITUTE(":" & A1&REPT(" ",6),":",REPT(":",255)),2*255,255),":","")
finally for third number enter
=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A1,":",REPT(" ",LEN(A1))),LEN(A1))),"]","")
Just tossing out some other options.
First number since it only has a length of 1 digit and is on the left side, use the following:
=RIGHT(LEFT(A1,2))
second number will be found by locating the : in the string
=MID(A1,FIND(":",A1)+1,FIND(":",A1,FIND(":",A1)+1)-(FIND(":",A1)+1))
third number will be dealt with in the same way as the second but we will use the second : and the ] as the identifiers as to where to grab from and how much to pull.
=MID(A1,FIND(":",A1,FIND(":",A1)+1)+1,FIND("]",A1)-(FIND(":",A1,FIND(":",A1)+1)+1))
now all those number will actually come through as text. If you want to have them as numbers in the cells, send them through a math operation that will not change their value. Do something like +0, -0, or *1 at the end. Alternatively you could add -- at the start of each formula (yes that is double - incase you were wondering if it was a typo)

Determine the number of search results upon using different sets of separators (Excel)

I would like to ask for your help with the formulation of a formula in Excel in order to compare the total number of search results upon using different sets of separator characters.
As I have multiple columns with content, as in the example below, I thought it would be possible to Count the search results in some way and do this for each column separately ( I would actually prefer to treat each column separately).
A
1 L-516-S-221-S-223
2 H-140.STR3
3 ST0 XP 23-9
4 etc.......
Preferably, I would like to use a varying a set of separator characters in order to determine the impact on the number of search results based on this set of separator characters. Logically, with an increasing number of separators more results will be returned (depending on separators included in the cell values of course).
The set of characters that I would like to experiment with is: “-_ .,;: “
Hopefully this makes sense and someone is able to help me out. Thank you.
Kind regards,
P
In your example - on its own will detect all three instances but for an overview you might construct a grid (say B1:H1 of your separators, including a space rather than an empty cell) and ColumnA each column in turn (maybe via links) then a formula in B2 such as:
=--ISNUMBER(FIND(B$1,$A2))
copied across to ColumnH and down to suit.
Alternative formula (for different question):
=IF(LEN($A2)-LEN(SUBSTITUTE($A2,B$1,""))>0,LEN($A2)-LEN(SUBSTITUTE($A2,B$1,""))+1,0)
Assumes, for example, no trailing spaces and separators are always separated. Results are not necessarily cumulative.

Add a comma after certain digits in 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.

Concatenate Custom Function

On a daily basis I need to load data to one of our systems. However Excel deletes the previous zeros in front of the contractor IDs. So i have to add THREE zeros manually. I normally use the CONCATENATE function however now the IDs are coming differently so some IDs now only need to have TWO zeros added.
example:
ID
911111
I use concatenate to make it look like:
000911111
I came up with the IF formula that detects if the ID starts with a number NINE, to concatenate TWO zeros and if not, then to add THREE zeros.
example:
=IF(LEFT(A32,1)="9",CONCATENATE("00",A32),CONCATENATE("000",A32))
Now I want to create this formula as a custom defined so I do not have to write down the formula ever time I work on the data every day.
Any suggestions I will really appreciate.
In addition to the formatting responses provided in the comments, you could use the RIGHT function to cut off the leading zeroes to the appropriate amount.
For example, assuming A1 holds a string of numbers, between 0 & 9 digits long. We can create text representing a 9 digit string, with as many leading zeroes as necessary, as follows:
=RIGHT(REPT("0",9) & A1,9)
REPT("0",9) tells Excel to repeat the character "0" 9 times. It then tacks on whatever text is in A1. Then it takes only the rightmost 9 characters of the concatenation.
I generally would recommend the Formatting options noted in those comments, unless you need the text to be 9 characters for other formula purposes.

Resources