I have the following INDEX MATCH SUM formula. It's only picking up the first criteria (ie. "Actual01"). How do I get it to pick up the other Actuals?
=SUM(INDEX(Sheet1!$N$2:$S$1011,MATCH(B40&"-"&$D$5,Sheet1!$A$2:$A$1011,0),MATCH({"Actual01","Actual02","Actual03","Actual04","Actual05","Actual06"},Sheet1!$N$1:$S$1,0)))
Related
I am attempting an Index-Match in which the match array consists of two criteria: it is greater than one column but less than or equal to a second column.
Simplified example:
Match-Index
=INDEX(C29,MATCH(A29,(A29>D29)*(A29<=E29),0))
This results in an error.
I am trying to get the value from column A based on conditions below:
a) column number will be where the value match for (1101,1138,1554...) e.g: 1101 is column B
b) Row number will be where the number 1,2,3.. match in the column that came from condition (a) e.g-B:B
You can use a combination of INDEX-MATCH functions to find the value in column A:A with 2 parameters.
Breakdown of Formula:
=INDEX(A3:A7,
MATCH(L2,
INDEX(B3:G7,0,MATCH(K2,B2:G2,0)),0
)
)
The 1st line in the formula is your return range.
The 2nd line is the row to match the lookup on.
The 3rd line finds the column for the row lookup by using another INDEX-MATCH.
You'll have to modify the formula to suit your needs of course.
I have a dataset looking at ratings over time:
A B C D E
ID Date Rating-1 Rating-2 Rating-3
1 01/01/20 Y
2 01/05/19 Y
3 15/12/19 Y
I want to extract the rating for a particular ID at a particular date. As the rating is not specified in the data (as each is represented by a Y value), I need to reference either the column heading or the column reference.
To get the relevant row, I can use a Match formula:
=MATCH(1,(1=$A$1:$A$4)*(DATE(2020,01,01)=$B$1:$B$4),0) - this will give row 2.
To get the column reference for a specific row, I can use a second Match formula: =MATCH("Y",$A3:$E3,0) - this will give column 4.
Is there a way to combine the two formulas to give me the column reference for a specified row (based on ID/Date criteria) and a specified column (the column with a Y value)?
I have tried a Index Match Match formula, but this seems to require the column reference to be specified, rather than finding a column with a Y value.
Try to avoid INDIRECT as it's volatile! There are other options such as below:
=INDEX(A1:E1,MATCH("Y",INDEX(A1:E4,MATCH(1,INDEX((A1:A4=1)*(B1:B4=DATE(2,020,1,1)),),0),0),0))
BTW, the nested INDEX is there to avoid necessity to CSE the formula. If you have ExcelO365 this could be removed.
Found a solution using INDIRECT, CONCATENATE and MATCH:
{=MATCH("Y",INDIRECT(CONCATENATE("$A",MATCH(1,(1=$A$1:$A$4)*(DATE(2020,01,01)=$B$1:$B$4),0),":$E",MATCH(1,(1=$A$1:$A$4)*(DATE(2020,01,01)=$B$1:$B$4),0))),0)}
Effectively, the CONCATENATE and INDIRECT parts of the formula creates a range specified by ID and Date criteria. This range takes the form of a single row in which to the MATCH function then searches for the Y value and returns the column number.
I am creating a matrix of sorts, where column A has a list of parts and the Row 1 is populated with weeks of the year in yyyy/mm format. What I am trying to do is populate this matrix with quantity data from an aggregate sheet, where the demand quantities for each part is listed by week of the year. In this aggregate sheet, column A lists the parts, column B lists the weeks, and column C lists the quantities.
I've been trying to write an =INDEX(MATCH(),MATCH()) type of formula in order to fetch the value of column C if the values from Columns A & B match the values in Column A and Row 1 respectively on the matrix sheet, but have been only getting #REF errors in return. At this point I need a second pair of eyes. Here is the formula:
=INDEX(MRP!$C$1:$C$6400,MATCH(A2,MRP!$A$2:$A$6400,0),MATCH(B1,MRP!$B$2:$B$6400,0))
Am I going about this the right way, or is another method needed instead?
Cell B2
=SUMIFS(MRP!$C:$C,MRP!$A:$A,Sheet1!$A3,MRP!$B:$B,Sheet1!B$1)
You can then copy these down and across.
You are getting the #REF error because you are out of range of the array you are trying to match. The index function takes two arguments and one optional argument.
INDEX(array, row_num, [column_num])
Looking at your formula,
=INDEX(MRP!$C$1:$C$6400,MATCH(A2,MRP!$A$2:$A$6400,0),MATCH(B1,MRP!$B$2:$B$6400,0))
MRP!$C$1:$C$6400 is the array to be matched
MATCH(A2,MRP!$A$2:$A$6400,0) gets the row number. Maybe it should be MATCH(A1....)?
MATCH(B1,MRP!$B$2:$B$6400,0) gets the column number.
But since your matching array only have one column, the column number from the match function is greater than 1, which is outside the range of the array.
If you need to match both values in column A and B, you can use this formula to match
=MATCH(lookup_value_1 & lookup_value_2, lookup_array_1 & lookup_array_2, match_type)
For you case, it would be
=MATCH(A1 & B1, MRP!$A$2:$A$6400 & MRP!$B$2:$B$6400, 0)
you'll need to commit your formula using Ctrl+Shift+Enter rather than just pressing Enter. This will get you the row number where both col A and B matches cell A1 and B1.
Finally, you can index it
=INDEX(MRP!$C$1:$C$6400,Result from above match,0)
I would use SUMIFS. Create a helper column in your second sheet with the month number in and then use
=SUMIFS(sheet2!column C, sheet 2!helper column, month(sheet1!A$1),sheet2! column A, sheet1!$A1)
I need to be able to find the row number of the row where matching criteria from A1 is equal or greater than values in column C and lesser or equal than values in column D
I can use INDEX and MATCH combo but not sure if this is something I should use for multiple criteria matching.
Any help or suggestions are highly appreciated.
I would not use MATCH to get the row number since you have multiple criteria. I would still use INDEX however to get the value of the row in E once the proper row number was discovered.
So instead of MATCH I would use an array formula using an IF statement that contained multiple criteria. Now note that array formulas need to be entered using ctrl + shift + enter. The IF statement would look like this:
=IF((A1>=C:C)*(A1<=D:D),ROW(A:A),"")
Note: I did not use the AND formula here because that cannot take in arrays. But since booleans are just 1's or 0's in Excel, multiplying the criteria works just fine.
This now gives us an array containing only blanks and valid row numbers. Such that if rows 5 and 7 were both valid the array would look like:
{"","","","",5,"",7,"",...}
Now if we encapsulate that IF statement with a SMALL we can get whatever valid row we want. In this case since we just want the first valid row we can use:
=SMALL(IF((A1>=C:C)*(A1<=D:D),ROW(A:A),""),1)
Which if the first valid row is 5 then that will return 5. Incrementing the K value of the SMALL formula will allow you to grab the 2nd, 3rd, etc valid row.
Now of course since we have the row number a simple INDEX will get us the value in column E:
=INDEX(E:E,SMALL(IF((A1>=C:C)*(A1<=D:D),ROW(A:A),""),1))
If you need to match more than one column value to retrieve a row number, that is, if two or more columns together create a unique ID you can use an array formula with MATCH as below:
MATCH(1,(A:A=J1)*(B:B=K1)*(C:C=L1),0)
where A, B, C contain the column array to be matched to retrieve the unique row number corresponding to the value in J1, K1, L1 respectively.
For a step-by-step guide, Christian Pedersen's Explainer