Trying to use VLOOKUP for two Lookup Values - excel

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.

Related

In Excel, how to verify a column value is present in another column, but looking over multiple columns

All I want to do is verify an exact phrase in a cell--over multiple columns--is present in another column cell.
For instance, say I had three name columns and one email column. I want to be able to write a function that looks over a row in the three name columns and, if that same row in the email column contains any of the exact phrases in the name columns, it will return true. Otherwise, return false. In this case, I basically just want to see if the email address has any of those exact names in it that the name columns have in its row.
The vlookup function, to my understanding, only lets you use one column in the lookup_value argument. Is there any way to look over multiple columns in there?
I appreciate any and all guidance.
I have an ugly solution for you.
=IF(OR(ISNUMBER(FIND(B1,A1)),ISNUMBER(FIND(C1,A1)),ISNUMBER(FIND(D1,A1))),True,False)
Screen Cap, since I can't embed images yet apparently.
The Find functions break the logic for the OR function, so the ISNUMBER function takes the #VALUE! and return False. I would have preferred COUNTIFS, but the wildcard search that worked with COUNTIF broke under COUNTIFS, so I went a different direction.

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)

Excel: Categorizing cells based on a partial match

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

Test whether a value in a cell matches another value in an array, and do an action if a match is found

I am trying to create a formula that will look at a cell and test the value in that cell against an array or multiple arrays of cells, and if a match is found, take another action like calculate a mathematical formula.
Really the action taken afterwards is not the issue, just used as a reference of what I ultimately intend to do with the formula. The biggest hurdle I am having is the first part of the formula where I need to test values.
I need to test the employee ID's in column W against the same employee ID's located in the "doors" columns and see if there is a match, and if there is, do another action.
Formulas I have tried, though I really don't know what I should be doing here:
{=IF(W5=T4:T7,"true")}
{=IF(OR(F4:F7,H4:H7,J4:J7,L4:L7,N4:N7,P4:P7,R4:R7,T4:T7)=W6,"True")}
Any help would be appreciated. Please let me know if I need to elaborate.
Use MATCH for one column:
=IF(ISNUMBER(MATCH(W6,$T$4:$T$7)),X6/5000*1000000,0)
For multiple columns:
=IF(ISNUMBER(AGGREGATE(15,7,ROW($B$4$:$T$7)/($B$4$:$T$7=W6),1)),X6/5000*1000000,0)

Can a countifs do this or do I need an array?

I have a data range B5:L100.
In column B is a string identifier, say 'X' or 'Y'.
In columns C:L we have different people's names entered (never more than once per row).
I want to count how many times a person's name appears in rows where column B is 'X'. The following formula doesn't work (using "Max" as the example person to search for).
Can you advise on what will do this elegantly?
=COUNTIFS(C5:L100,"Max",B5:B100,"X")
I think an array formula might be in order, but I'm not too experienced on those.
One way to do this is to just do it column by column:
=COUNTIFS(C5:C100,"Max",B5:B100,"X")+COUNTIFS(D5:D100,"Max",B5:B100,"X")... etc
Does the trick, but not too elegant if you have loads of columns to look through. I'm sure there's a tidier way using an array formula.
=SUMPRODUCT((C5:L100="Max")*(B5:B100="X"))

Resources