Any MS Excel experts, please help.
Discussion
Hello, I am working through a list of about 100,000 part numbers in 3 Excel spreadsheets, and now I have just been told I need to seperate some with a certain layout.
I need to find and seperate any part number with a '-' between a letter and a letter, a '-' between a number and a letter(or vice versa) is ok, as is a '-' between a number and a number.
I have tried using the auto filter, but the wildcard (?) character is not specific to denote a letter or number, instead just any character.
Does anyone know a way i can get this filtered or a formaula that will enable me to do this?
Thanks in advance for any assistance.
I need to find and seperate any part number with a '-' between a letter and a letter, a '-' between a number and a letter(or vice versa) is ok, as is a '-' between a number and a number.
I have tried using the auto filter, but the wildcard (?) character is not specific to denote a letter or number, instead just any character.
Does anyone know a way i can get this filtered or a formaula that will enable me to do this?
Thanks in advance for any assistance.
That one has fooled me. However, there may be a way by instead of filtering get excel to sort them instead as it usually does numbers first then letters, then letter followed by number, then finally letters followed by letters. So should leave all of your letters-letters at the bottom, maybe. Give it a try.
Pete
Pete
Pretty straightforward.
If Cell A2 contains 1234-5678 then the following steps seem to work . .
In cell B2, ID left of "-" : =RIGHT(LEFT(A2,(FIND("-",A2)-1)),1)
In cell C2, use VLOOKUP on a list to identify whether a Letter or Number. I sumply created a list in colJ of a-z and 0-9. In colK, I put whether the character in colJ was a Letter ot Number see example below: =VLOOKUP(B2,J:K,2,0)
In cell D2, ID right of "-" : =LEFT(RIGHT(A2,LEN(A2)-(FIND("-",A2))),1)
In cell E2, use VLOOKUP to identify whether letter or number : =VLOOKUP(D2,J:K,2,0)
Finally combine colsC and E in cell F2 : =C2&E2. This will form on of 4 combinations and you can apply an AutoFilter.
ColJ ColK
a Letter
b Letter
c Letter
I've a simple file set up, send me your email and I'll mail it to you.
and so on
If Cell A2 contains 1234-5678 then the following steps seem to work . .
In cell B2, ID left of "-" : =RIGHT(LEFT(A2,(FIND("-",A2)-1)),1)
In cell C2, use VLOOKUP on a list to identify whether a Letter or Number. I sumply created a list in colJ of a-z and 0-9. In colK, I put whether the character in colJ was a Letter ot Number see example below: =VLOOKUP(B2,J:K,2,0)
In cell D2, ID right of "-" : =LEFT(RIGHT(A2,LEN(A2)-(FIND("-",A2))),1)
In cell E2, use VLOOKUP to identify whether letter or number : =VLOOKUP(D2,J:K,2,0)
Finally combine colsC and E in cell F2 : =C2&E2. This will form on of 4 combinations and you can apply an AutoFilter.
ColJ ColK
a Letter
b Letter
c Letter
I've a simple file set up, send me your email and I'll mail it to you.
and so on
Vee said:
Pretty straightforward.
If Cell A2 contains 1234-5678 then the following steps seem to work . .
In cell B2, ID left of "-" : =RIGHT(LEFT(A2,(FIND("-",A2)-1)),1)
In cell C2, use VLOOKUP on a list to identify whether a Letter or Number. I sumply created a list in colJ of a-z and 0-9. In colK, I put whether the character in colJ was a Letter ot Number see example below: =VLOOKUP(B2,J:K,2,0)
In cell D2, ID right of "-" : =LEFT(RIGHT(A2,LEN(A2)-(FIND("-",A2))),1)
In cell E2, use VLOOKUP to identify whether letter or number : =VLOOKUP(D2,J:K,2,0)
Finally combine colsC and E in cell F2 : =C2&E2. This will form on of 4 combinations and you can apply an AutoFilter.
ColJ ColK
a Letter
b Letter
c Letter
I've a simple file set up, send me your email and I'll mail it to you.
and so on
I have an alternative solution which uses a single cell. The formula returns a booleand value. True if it matches the Alpha-Alpha criteria and false if it dosent. If Cell A2 contains 1234-5678 then the following steps seem to work . .
In cell B2, ID left of "-" : =RIGHT(LEFT(A2,(FIND("-",A2)-1)),1)
In cell C2, use VLOOKUP on a list to identify whether a Letter or Number. I sumply created a list in colJ of a-z and 0-9. In colK, I put whether the character in colJ was a Letter ot Number see example below: =VLOOKUP(B2,J:K,2,0)
In cell D2, ID right of "-" : =LEFT(RIGHT(A2,LEN(A2)-(FIND("-",A2))),1)
In cell E2, use VLOOKUP to identify whether letter or number : =VLOOKUP(D2,J:K,2,0)
Finally combine colsC and E in cell F2 : =C2&E2. This will form on of 4 combinations and you can apply an AutoFilter.
ColJ ColK
a Letter
b Letter
c Letter
I've a simple file set up, send me your email and I'll mail it to you.
and so on
The formula is:
=IF(FIND("-",A1,1),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1)) <48,CODE(MID(A1,FIND("-",A1,1)+1,1)) >57),OR(CODE(MID(A1,FIND("-",A1,1)-1,1)) <48,CODE(MID(A1,FIND("-",A1,1)-1,1)) >57)),FALSE)
Where A1 is the cell reference that contains the part number.
PP - now I understand it
The find function finds the dash and returns it's position, the code and mid returns the codes for the string characters either side (code returns a number for the first character of any string from i.e. code( "9" ) = 57 and code ( "A" ) = 65) and all the or's and and's create the scenario of which two letter characters return the "True" value.
Though it might need a < 123 and something to knock out the 91 - 96 range as these are special characters that will still return a True value.
Though it might need a < 123 and something to knock out the 91 - 96 range as these are special characters that will still return a True value.
Edited by Jinx on Thursday 31st May 16:27
Jinx said:
PP - now I understand it
The find function finds the dash and returns it's position, the code and mid returns the codes for the string characters either side (code returns a number for the first character of any string from i.e. code( "9" ) = 57 and code ( "A" ) = 65) and all the or's and and's create the scenario of which two letter characters return the "True" value.
Though it might need a < 123 and something to knock out the 91 - 96 range as these are special characters that will still return a True value.
Yes thats right. It might need to filter out other characters if they are in the part numbers. But from what the OP said part numbers consist of Letters, Numbers and "-" so I didn't consider any other filtering.Though it might need a < 123 and something to knock out the 91 - 96 range as these are special characters that will still return a True value.
Edited by Jinx on Thursday 31st May 16:27
plasticpig said:
I have an alternative solution which uses a single cell. The formula returns a booleand value. True if it matches the Alpha-Alpha criteria and false if it dosent.
The formula is:
=IF(FIND("-",A1,1),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1)) <48,CODE(MID(A1,FIND("-",A1,1)+1,1)) >57),OR(CODE(MID(A1,FIND("-",A1,1)-1,1)) <48,CODE(MID(A1,FIND("-",A1,1)-1,1)) >57)),FALSE)
Where A1 is the cell reference that contains the part number.
PP, Thanks to you also, both ways work well, and have totally gone way over my head, guess thats why I work as an aircraft engineer and not a programmer or something similar.The formula is:
=IF(FIND("-",A1,1),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1)) <48,CODE(MID(A1,FIND("-",A1,1)+1,1)) >57),OR(CODE(MID(A1,FIND("-",A1,1)-1,1)) <48,CODE(MID(A1,FIND("-",A1,1)-1,1)) >57)),FALSE)
Where A1 is the cell reference that contains the part number.
Thanks to both you and VEE
plasticpig said:
I have an alternative solution which uses a single cell. The formula returns a booleand value. True if it matches the Alpha-Alpha criteria and false if it dosent.
The formula is:
=IF(FIND("-",A1,1),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1)) <48,CODE(MID(A1,FIND("-",A1,1)+1,1)) >57),OR(CODE(MID(A1,FIND("-",A1,1)-1,1)) <48,CODE(MID(A1,FIND("-",A1,1)-1,1)) >57)),FALSE)
Where A1 is the cell reference that contains the part number.
Hi PP, are either you, or anyone else on here able to adapt the above formula to show a '-' between a alpha/numeric and/or a numeric/alpha(but to disregard a '-' between a numeric/numeric.The formula is:
=IF(FIND("-",A1,1),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1)) <48,CODE(MID(A1,FIND("-",A1,1)+1,1)) >57),OR(CODE(MID(A1,FIND("-",A1,1)-1,1)) <48,CODE(MID(A1,FIND("-",A1,1)-1,1)) >57)),FALSE)
Where A1 is the cell reference that contains the part number.
Heres hoping.
megy said:
plasticpig said:
I have an alternative solution which uses a single cell. The formula returns a booleand value. True if it matches the Alpha-Alpha criteria and false if it dosent.
The formula is:
=IF(FIND("-",A1,1),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1)) <48,CODE(MID(A1,FIND("-",A1,1)+1,1)) >57),OR(CODE(MID(A1,FIND("-",A1,1)-1,1)) <48,CODE(MID(A1,FIND("-",A1,1)-1,1)) >57)),FALSE)
Where A1 is the cell reference that contains the part number.
Hi PP, are either you, or anyone else on here able to adapt the above formula to show a '-' between a alpha/numeric and/or a numeric/alpha(but to disregard a '-' between a numeric/numeric.The formula is:
=IF(FIND("-",A1,1),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1)) <48,CODE(MID(A1,FIND("-",A1,1)+1,1)) >57),OR(CODE(MID(A1,FIND("-",A1,1)-1,1)) <48,CODE(MID(A1,FIND("-",A1,1)-1,1)) >57)),FALSE)
Where A1 is the cell reference that contains the part number.
Heres hoping.
If you do then:
=IF(NOT(ISERROR(FIND("-",A1,1))),NOT(AND(AND(CODE(MID(A1,FIND("-",A1,1)+1,1))>=48,CODE(MID(A1,FIND("-",A1,1)+1,1)) <=57),AND(CODE(MID(A1,FIND("-",A1,1)-1,1))>=48,CODE(MID(A1,FIND("-",A1,1)-1,1)) <=57))),FALSE)
IF you dont then:
=IF(NOT(ISERROR(FIND("-",A1,1))),OR(AND(OR(CODE(MID(A1,FIND("-",A1,1)-1,1))<48,CODE(MID(A1,FIND("-",A1,1)-1,1))>57),AND(CODE(MID(A1,FIND("-",A1,1)+1,1))>=48,CODE(MID(A1,FIND("-",A1,1)+1,1))<=57)),AND(OR(CODE(MID(A1,FIND("-",A1,1)+1,1))<48,CODE(MID(A1,FIND("-",A1,1)+1,1))>57),AND(CODE(MID(A1,FIND("-",A1,1)-1,1))>=48,CODE(MID(A1,FIND("-",A1,1)-1,1))<=57))),FALSE)
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


