Excel INDEX/MATCH formula - excel

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

Related

Find a value in a range (any of multiple column or rows) and return the value in far left most column of that row

Looking for something like a typical index match formula that can look to the right and return value to the left, but look at all columns in a range. Take below valid formula for example.
(Excel 2021.)
Finds A1's value in column D, and it returns value from column C.
=INDEX($C$1:$C$10,MATCH(A1,$D$1:$D$10,0))
In my ideal world I can Keep $D$1 and change $D$10 to $F$10 so it searches all columns D/E/F, and still returns C like below. However that does not work in our real world, any other ideas please? Thanks!
=INDEX($C$1:$C$10,MATCH(A1,$D$1:$F$10,0))
Update*
To clarify there are mix of letters and numbers. Also this table will be about 50k rows so hoping as simple as possible.
Also Column C will all be unique for sure, and D-F should be unique values but there is a chance a mistake and a few duplicates might be in.
You need MMUL() with INDEX(). Try below formula if you have Excel-365.
=FILTER(C1:C10,MMULT(--(D1:F10=A1),SEQUENCE(COLUMNS(D1:F1))))
For older version try
=INDEX($C$1:$C$10,LARGE(MMULT(--($D$1:$F$10=A1),TRANSPOSE({1,1,1}))*ROW($C$1:$C$10),1))
Since your INDEX/MATCH take from the same rows, you can first simplify your original search with
=XLOOKUP(A1,$D$1:$D$10,$C$1:$C$10)
XLOOKUP combines HLOOKUP and VLOOKUP with exact match being the default.
This will work for searching three rows
IFERROR(IFERROR(XLOOKUP(A1,$D$1:$D$10,$C$1:$C$10), XLOOKUP(A1,$E$1:$E$10,$C$1:$C$10)), XLOOKUP(A1,$F$1:$F$10,$C$1:$C$10))
We can name the columns colC, colD, colE, and colF and it becomes
IFERROR(IFERROR(XLOOKUP(A1,colD,colC), XLOOKUP(A1,colE,colC)), XLOOKUP(A1,colF,colC))
As with other lookups, this returns the first value or #N/A error.
This could be made more scalable for higher number of rows if we are allowed to add a column somewhere.

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

Excel: Compare strings in column 1 and sum their values from column 2

I Have two columns of data. Column 1 has dates. Column 2 has value ranging from 1 - 5, so each Date will have a value associated with it on the same row. I am trying to compare dates in column 1 and Match same dates. I would then like to Sum the matched dates values together.
Edit: I am Sorry I assumed tagging Excel formula would imply I was looking for an excel formula that would fork best to try this. I am taking on a project on my own and have no support from others. Stack overflow is an amazing resources for people like myself with little experience to connect with experts. However the responses so far seem rude and unsympathetic to someone trying to learn a new approach to excel.
I tried to create this statement to find matching dates in column E and then multiply their values in column G. So far it just adds up column G.
=IF(MATCH(E2,E:E),SUM(G2,G:G),PRODUCT(G2,1))
Is their an easier formula to use? What does the =INDEX formula do, and would it help store the values on the rows of the matched dates?
Assuming Dates are in Column G with associated Values in Column I and dates to compare are in Column K then to get Sum of values of each date from Column K enter the following formula in Cell L2
=SUMIF($G$2:$G$21,K2,$I$2:$I$21)
Drag/Copy down as required. Change range as needed. See image for reference.
If anything is not clear let me know.
PS : Now imagine if I write only the formula in my answer without any explanation or screen-shot. Will you be able to understand my answer. Probably No. So people here are not rude, its just we want sufficient information in question so that we can understand and help you better. We are here to ask and answer questions and help anybody in solving their problem provided we understand the problem and efforts from your side could be seen in solving your problem.

VLOOKUP with criterias from both row and column

I have a big table like this (imagine round-robin result table) where both column and row are team names that First row will be exactly like First Column
Because the table is very big so it is hard to look up for value if I have to look for multiple values
So I'd like to create a table like this
Let's say I want to look up the first "?" in this small table. What formula can I use to look up A2(column)xA3(row) from the big table?
I hope I made it clear enough.
Any pointers or resource I could read online would be greatly appreciated.
I would break this down in two parts.
Get a lookup working for row values using VLOOKUP(). Here is an example: VLOOKUP($A3, BigTable!$A$2:$CW$101, 2, 0):
$A3: Lookup value to find. Dollar sign locks just the column so that when you drag the formula across A doesn't change
BigTable!$A$2:$CW$101: Range to find the result. Dollar sign completely locks the range so wont change
2: Column to bring back (For the time being it is always going to bring back second column)
0: Look for an exact match
Get a lookup working for the column values so that when the formula is copied across it automatically updates the column that it is looking for. I used MATCH() to find the position of the column value in BigTable. For example: MATCH(B$1, BigTable!$B$1:$CW$1, 0):
B$1: Column header to lookup up the position of in the BigTable. Dollar sign locks the row so when you move it down it remains as 1
BigTable!$B$1:$CW$1: Header column to look through
0: Look for an exact match
Finally put the two pieces of the formula together and check some of the values to make sure that it is working correctly: VLOOKUP($A2, BigTable!$A$2:$CW$101, MATCH(B$1, BigTable!$B$1:$CW$1, 0), 0)
This would then give you one formula to copy across the whole of the SmallTable to lookup up the relevant values in the BigTable.
http://www.contextures.com/xlFunctions03.html
Read example 3, it is exactly like my problem.. Thank #DirkReichel for suggesting Index function, so I could know where even to start.

Resources