Dec 13 2021 07:50 AM
Hi Excel community,
I am trying to build a large data file decoding part numbers. Part numbers have different lengths and compositions and they are all mixed up. All I need is a simple check saying if the cell with the part number contains in any position one of the following letters please return the value assigned to this letter:
In other words: if the part number contains "TR" please return "small", if it contains "PN" please return big etc.
TR | small |
PN | big |
CWR | middle |
EXT | large |
I tried several options but none of them was working.
Thanks in advance for your help
Dec 13 2021 08:17 AM
Hi @martin7b
You may take help from SEARCH() functions, assume the parts numbers are stored in column A then use below formula column B.
=IF(IFERROR(SEARCH("TR",A3,1),0)>0,"Small",IF(IFERROR(SEARCH("PN",A3,1),0)>0,"Big",IF(IFERROR(SEARCH("CWR",A3,1),0)>0,"Middle","Large")))
You may also refer to the attached sample file for more understanding.
Thanks
Tauqeer
Dec 13 2021 08:46 AM
Enter the little list from your post into a worksheet - it doesn't matter where.
Select its first column, with the letter combinations.
Click in the name box on the left hand side of the formula bar.
Type a name, for example Parts, and press Enter.
Select its second column, with the sizes.
Click in the name box on the left hand side of the formula bar.
Type a name, for example Sizes, and press Enter.
Now let's say your part numbers are in E2 and down.
In the cell next to it, enter the formula
=INDEX(Sizes,MATCH(TRUE,ISNUMBER(SEARCH(Parts,E2)),0))
or
=TEXTJOIN("",TRUE,IF(ISNUMBER(SEARCH(Parts,E2)),Sizes,""))
If you don't have Excel in Office 2021 or Microsoft 365, confirm with Ctrl+Shift+Enter.
Then fill down.
Dec 14 2021 05:53 AM
Thanks for your quick answer - I have this solution - the issue is that the list with the codes is very long (+50 different codes and this makes the formula very long as well) - we are also modifying the list from time to time so I would like to have it dynamic for an enduser who is not familiar with formulas so he just can edit the list. sorry for the missing additional information from my side in the innitial post. Any idea?
Thanks
Dec 14 2021 05:56 AM
Dec 14 2021 06:09 AM
SolutionSee the attached sample workbook. The Parts and Sizes names are dynamic in this version - they will automatically be adjusted when you add or remove part numbers. See Formulas > Name Manager for their definition.
Dec 15 2021 12:46 AM
Apr 22 2022 12:11 PM
This looks like something i have been strugeling with ... However. Is it posible to the two sheets as two different files insted of inside the same worksheet?@Hans Vogelaar
Apr 22 2022 01:13 PM
It's possible but I would not recommend it. The workbook with the lookup list would have to remain open, otherwise the formulas would return an error. That kind of defeats the purpose.
Apr 22 2022 01:23 PM
@Hans Vogelaar Thanks for the quick answer. I see your point. Just to bad for me :)
Apr 22 2022 01:36 PM
@Hans Vogelaar Don't know if i can post this here or i need a new post enterly?
However the solution given in this threat is very close to what im looking for. Dont know if it is posible tho. To have an open sheet search for words for a not open file.
my problem is that i have many sheets that need to search for the same values and i dont want to update the database across all of the sheets. So if the database/list chould be located only one place then i chould updatse it just once.
excampels in photos:
Apr 22 2022 01:55 PM
That is a rather awkward setup. Moreover, you're going to run into problems since "roastbeef" contains "roast". "roast potatoes" would classify as both pork and beef...
Apr 22 2022 02:12 PM
Apr 22 2022 02:21 PM
Apr 22 2022 02:23 PM
Nov 09 2023 06:47 AM
@Hans Vogelaar I have a similar problem as described in this thread. I have a table titled "Properties" with a column titled "Property Name" listing properties by name and another column titled "County" listing which county each property is found within. Each property is found within one of 4 regions. I want to use the associated county to prescribe a region to each property in a third column titled "Region". I have a separate table titled "Counties by Region" with each region number as headers and the counties contained within in their respective region column. How do I write a formula in the "region" column of the "properties" table that searches for each county within the "Counties by Region" table and returns the column header in which the county name was found?
Nov 09 2023 07:11 AM
I'd use a range like this:
You can then use a simple VLOOKUP or XLOOKUP formula to return the region that a specific county belongs to.
Nov 09 2023 07:57 AM
Feb 15 2024 05:01 PM
Hello,
I realize that this thread is older but this works really well for my purposes with a few issues.
Can you give a breakdown of the formula in Name Manager?
=OFFSET(Lists!$A$1,1,0,COUNTA(Lists!$A:$A)-1,1)
I'm using this on part numbers instead and have instances with similar part numbers returning the wrong data. I've outlined a few instances below.
1 | BerryBites |
62 | CitrusZing |
100 | MangoMunch |
5 | PineapplePops |
620 | KiwiSqueeze |
7 | MelonMorsels |
So 100, is returning BerryBites instead of MangoMunch.
Can you lend some aid?
Thank you.
Feb 16 2024 12:51 AM
The formula says the following:
If you do not have a header in A1, the formula should be
=OFFSET(Lists!$A$1,0,0,COUNTA(Lists!$A:$A),1)
Dec 14 2021 06:09 AM
SolutionSee the attached sample workbook. The Parts and Sizes names are dynamic in this version - they will automatically be adjusted when you add or remove part numbers. See Formulas > Name Manager for their definition.