Index Match with Match Ranges - excel-formula

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.

Related

Excel - Return column reference from row and column criteria

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.

Index Match Sum with multiple column criteria

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)))

Excel - Get value of a column in a row where match found in another column

I need to track where value in J column starts appearing zero. In following table, its 7th row. From this row, I need to get value of D column to appear in some designated Cell outside this table. In this case it would be 11 y, 2 m.
I used offset function, that gives me first occurrence of zero in J column. But I'm not sure how to lookup different column (D) from the same row to fetch it's value.
My formula: =OFFSET(J1,MATCH(0,J:J,0)-1,0)
Here actual data starts at first row; hence 1 is used above. It correctly returns first zero (0) occurrence in J column.
Assuming the column is sorted so that the first zero is the only zero that matters, one of many solutions is Index Match.
=Index(D:D,Match(0,J:J,0))
Index returns the value of nth position in a list. Match returns the position of the of the first match in a list; the 0 at the end is a parameter to specify an exact match. When both lists are the same length, such as two columns in a table, then you use Match to find the index and use Index to find the value of an arbitrary column.
So, in this example, Match returns 7. The 7th position in Column D is 11y, 2m
In the very near future (or right now for some people) you will be able to use XLookup to do the same thing.

Find the ROW number in excel with multiple matching criteria

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

Find last occurrence of specific value in a row

I have a table that keeps scores from fantasy football league. The lowest scoring week is not included in the total.
I'm able to find the lowest score using the =min function [=min(B2:R2)]
I can find the first instance using the =match function. [=MATCH(S2,B2:R2,0)]
However I would like a formula that returns the latest occurrence of the lowest scoring week.
For example Portia lowest score is 8 the first occurrence is week 4 but I would like it to return the latest occurrence which is week 11
You can also do this using LOOKUP function and avoiding array formulas, e.g. assuming S2 has the minimum value you can get the last week with that value with this formula in T2 copied down
=LOOKUP(2,1/(B2:R2=S2),B$1:R$1)
This works because (B2:R2=S2) returns an array of TRUE/FALSE values, and then dividing 1 by that array gives you an array of 1s or #DIV/0! errors. When you use 2 as the lookup value on that array it won't find any 2s so will therefore match with the last number (the last 1) in the array. That corresponds to the last week with your smallest value so using the top row as the "return vector" means that the formula returns the corresponding week number as required
You will need to use an Array Formula to achieve this. The following will return the "highest" lowest value if you are using columns B:R as the data columns and column T as the Low Week column. You need to enter this as an array (CSE) formula by copying and pasting it into cell T2 and pressing Ctrl+Shift+Enter.
=IFERROR(INDEX($A$1:$R$1,1,SMALL(IF(B2:R2=MIN(B2:R2),COLUMN(B2:R2),FALSE),COUNTIF(B2:R2,MIN(B2:R2)))),"")
Explanation
First, the COUNTIF(B2:R2,MIN(B2:R2)) will count the number of times the minimum value occurs. This is needed because a simpleMIN(B2:R2) will only grab the first minimum value, not the nth minimum value.
Next, the IF(B2:R2=MIN(B2:R2),COLUMN(B2:R2),FALSE) is the actual array formula part of the equation (the reason why you need to use Ctrl+Shift+Enter). It will only return the references for when you have a minimum and returning FALSE for all other entries greater than the minimum. Now, you have an array of only the column numbers the smallest values in the dataset.
Then, the SMALL(IF(B2:R2=MIN(B2:R2),COLUMN(B2:R2),FALSE),COUNTIF(B2:R2,MIN(B2:R2))) will take the column numbers of the smallest values and find the latest occurrence of this, which comes from the COUNTIF(B2:R2,MIN(B2:R2)) code.
Now that the last smallest occurrences' column number is know, you can use the INDEX function to find the value in the first row INDEX($A$1:$R$1,1.
Finally, the IFERROR will display the Low Week row if the SMALL function finds a match, otherwise it will display a blank cell. This could be used to copy this array formula further down the page for rows that you don't yet have users for.
Result

Resources