Excel: Categorizing cells based on a partial match - excel

UPDATE: found an answer to my problem through this website: https://exceljet.net/formula/categorize-text-with-keywords
I'm trying to categorize certain products based on the beginning of each product name. My first table is the look-up table below:
My second table currently looks like this:
And I want the end result of that second table to look like this:
What excel formula can I use to achieve the red column? I've tried scouring the internet, for the formula that best suits my need, but I can't figure it out. I've seen people throw out the =Lookup(Search()) function, but my formula needs to start with the key word, but just contain the keyword somewhere in the cell.
I've read many different forums, but I haven't been able to find one that answers a scenario similar enough to mine. Any suggestions are appreciated.

If the first word of the Product Name is always matched to the product start, you can vlookup by just the 1st word. Assuming your product start is in column A, Categerization in Column B, Product Name in Column C, you can key in the formula in Column D:
'''
=vlookup(left(C2,search(" ",c2)-1),A:B,2,0)
'''

Just set your vlookup 4th parameter to TRUE:
Note: formula as written can be drag/filled down from B2. Also your Category Table needs to be in A-Z sorted order.
HTH

Related

Using VLOOKUP and not only match on first value

I'm trying to use VLOOKUP to match activities with product codes, but run into an issue since VLOOKUP always returns the first match. I did a mockup below to describe my issue. To the left, I have a table with activity names and product codes.
To the right, in column G, I want to, based on matching activity names in column F with activity names in column A, assign the activities product codes from column B.
When I use VLOOKUP, it only matches with the first activity name and give all the activities with the same name the same product codes. I need them to get different product codes even if they have the same name. I want my function to "take the next one" on the list, when the first one is taken.
Should I try to use another function to solve this? Is it impossible with VLOOKUP? My 'real' document has like 2000 rows, and the solutions I found on Youtube was not good to scale.
Thanks in advance. I'm new to here so if I should clarify my question in any way, feel free to tell me.
If the raw is around 2,000 rows, you can use a nested index match with helper columns.
Add a rank in column C with the formula =COUNTIF(A2:$A$2,A2)
Then apply the same ranking in your output part as well (Ensure Activity Name is sorted so that the formula works), Output rank formula =IF(J2=J1,I1+1,1)
Formula that lists out the Product Code {=INDEX($B$2:$B$3190,MATCH(I2,IF($A$2:$A$3190=J2,$C$2:$C$3190),0))}
This is an array formula, you get the curly brackets by hitting control+shift+Enter instead of just Enter upon keying in the formula
If you are using excel 365, you can use UNIQUE formula.
=UNIQUE(A2:B18)

Trying to use VLOOKUP for two Lookup Values

I have this formula:
=VLOOKUP(1910921,'All Training Raw Data'!A:C,2,FALSE)
The 1910921 refers to a training course but that training course has two ID's. The other being 01929831. I am looking to use the VLOOKUP function to find the email address of who has completed this course. How can I incorporate this second course ID into the VLOOKUP function?
Thanks
If I suppose that your first ID is in the column B and the second one in the column C and the e-mails in the column D, then you can do the following.
In the column A (the example is for A2) put the following formula :=CONCATENATE(B2,C2). Then change your VLOOKUP formula to include the additional ID and look for it in the column A, like this:
=VLOOKUP(191092101929831,'All Training Raw Data'!A:D,4,FALSE).
The other user's replies seem to be OK as long as you really need to do it with VLOOKUP function. Although, as I have already commented above I feel like it might not be the best option, as VLOOKUP always returns the value of the first match. Instead you could try using this formula.
=IF(MATCH($A1,$I$1:$I$2,0),&B1,"")
If you have the courses IDs on I:I column, you check if the course done by the user matches with any of them. If the condition is true, it will return the email from him, which I am guessing it is on the B:B column.
It worked for me so, adapt the ranges to your case and I hope it works for you too.

How to sumif the vlookup value of a range?

I'm not sure how to explain what I am trying to achieve so I will start with the data I am working with:
1) A table that lists IDs corresponding to Games. Each game has several IDs.
2) A table that lists IDs and $ Earned on those IDs.
In another table, I have the list of games and want to return the sum of $ Earned on those games:
Tables 1,2,3
I was trying to do this with a combination of a SUMIF and VLOOKUP formula but I can't seem to find a way to do that because the VLOOKUP returns a value rather than a range. What I want to do is sum a sum_range ($ earned) if the lookup value of the range (game corresponding to the code) is a match.
I could simply add a column to the second table that returns the game of that code with a VLOOKUP. But the problem is that this would need to be done in a very large number of sheets, and with each time the new data is received.
Hopefully that made sense and thank you in advance for any help I can get!
Cheers,
Maria
Well this may be a bit of a cheat. if you look at your game code, you are either looking for basketball or baseball. So we could do a sum if the code contains one of those words.
If case sensitivity is important
=SUMPRODUCT(--(ISNUMBER(FIND("Basketball",B2:B16)))*C2:C16)
or if case sensitivity is not important
=SUMPRODUCT(--(ISNUMBER(SEARCH("Basketball",B2:B16)))*C2:C16)
B2:B16 would be your code in table 2
C2:C16 would be your $ earned column in C2
The formula would be placed where the ? cell is beside big win Basketball.
updated option for keyword
So if you are not looking for just baseball or basketball, but the entire string of the key words that you are looking for the total for, you could use the following provided the words in table three form part of the code when the spaces are removed.
=SUMPRODUCT(--(ISNUMBER(FIND(SUBSTITUTE(B19," ",""),B2:B16)))*C2:C16)
or
=SUMPRODUCT(--(ISNUMBER(SEARCH(SUBSTITUTE(B19," ",""),B2:B16)))*C2:C16)
This assumes the keyword your are looking for in the code is in B19. The substitute function removes the spaces to match your code.
In the second table add a (hidden) column, where you perform a VLOOKUP in the first table of the Code, retrieving the Game name.
Now you have something to base your SUMIF on: the value in the additional, hidden column should match the Game you have in your summary.

Adding based on text string in a cell in a table

So I have a table with description lines like this: EFT VISA RF#509723083734 04/07 ENDICIA POSTAGE (EMS) 650-321-2640.
What I'd like to be able to do is add up all the amounts with descriptions containing "Endicia".
I tried =VLOOKUP(SEARCH("endicia",D9,0)="true",D2:F12,3) but that didn't work.
I tried using SumIf instead, with similar lack of success.
Any advice would be much appreciated
IF helpful, the description is in column D and the amount is in column E.
If you can add an additional column, you can add one in that only counts the number if the keyword ("ENDICIA") is found in the cell (otherwise return 0).
=IFERROR(IF(FIND("ENDICIA",D1),E1,0),0)
From there you just need to sum the column where you put this formula.
Please try:
=SUMIF(D:D,"*ENDICIA*",E:E)

Excel INDEX/MATCH formula

I need to download warehouse inventory levels in a CSV, every morning, and update my website inventory CSV based on those numbers.
I've combined them into one worksheet.
Image: http://i62.tinypic.com/1zqxd7n.png
Column K contains the SKUs of all the items in my online store.
In column A is the list of the warehouse's SKUs, sorted to only display out-of-stock items.
I need to go down column A and see if that SKU exists in my store by looking in column K. If it's not in column K, ignore. "999999999" just means "in-stock." If it is in column K, write "0" in the cell one right of it, for "out-of-stock."
I'm looking for the formula for column L. So far I've tried something like =0*(INDEX(K:K,MATCH(A3,K:K,0))), but I think I've got it all wrong.
This problem is similar to the one here, but slightly different.
I would greatly appreciate your help, it would save me a LOT of time. Thanks in advance!
Eric, . The following formula should give you what you are after. I have replaced '999999' and '0' with a narrative return, as the logic (in the question) for whether or not an item is in stock appears to be the wrong way around.
Since an error would ordinarily be returned by a straight Index/Match formula, when a value cannot be found, you can build that into the formula.
=IF(ISERROR(INDEX(K:K,MATCH(A3,K:K,0))),"Cannot Find in Col K","Can Find in Col K")
You don't really need INDEX function if you aren't retrieving any values, perhaps try this formula:
=IF(COUNTIF(K:K,A3),999,0)
That will return 999 if A3 exists in column K, otherwise 0

Resources