Excel 2010 Index Match using multiple criteria - excel

I have a following reference table that I am using to extract the values
Table 1:
Name Jan Feb Mar Apr Total
John 0.1 0.2 0.3 0.4 1
Peter 0.2 0.4 0.6 0.3 1.5
Suman 0.1 0.3 0.2 0.5 1.1
into this table-
Table 2:
Name Month Value
John Feb
Peter Apr
Suman Jan
I need to match the text in "Name" column of Table 2 with the text in "Name" column in Table 1..and match the text in "Month" column of Table 2 with the Column Name itself in Table 1 to return the value for that particular column name
For example:
Match value "John" in Table 2 with value "John" in Table 1 Match value "Feb" in Table 2 with Column Name "Feb" in Table 2 to return the value 0.2 from Table 1
Can this be done using Index-Match using multiple criteria?

Assuming Table 1 starts in A1 and Table 2 starts in J1.
In Column L ("Value" column) starting in cell L2 place the formula:
=INDEX($A$1:$F$4,MATCH($J2,$A$1:$A$4,0),MATCH($K2,$A$1:$F$1,0))
And copy down to all relevant rows.
The first match selects the row for the index by matching the name and the second match selects the column by matching the month. Hope this helps. Cheers,

Related

Finding the first value greater than x in dynamic arrays for Excel

As shown on Table 1, I have a list of tenors and on Table 2 there is a list of cashflow times.
I would like to make a fully dynamic sheet and are using "#" referencing.
(1) the first tenor that is greater than the cashflow time column (as shown on result 2)
(2) the last value that is smaller than the cashflow time column (as shown on result 1).
Table 1
tenor
0
0.25
0.5
1
2
3
4
5
Table 2
cashflow time
result1
result2
-0.7392
n/a
0
0.1697
0
0.25
0.4216
0.25
0.5
0.6735
0.5
1
0.9253
0.5
1
1.1690
1
2
1.4209
1
2
For result1:
=XLOOKUP(C2:C8,A2:A9,A2:A9,,-1)
For result2:
=XLOOKUP(C2:C8,A2:A9,A2:A9,,1)
where C2:C8 are the cashflow time values nd A2:A9 are the tenor values.

Excel formula help - I have 14/28 day readings averaged per day which need to be recorded as daily readings

Dates when the data was read are shown on the date column on the left, then worked out a value per day shown in ET/DAY column.
To analyze monthly data etc etc I want daily data so every day has the ET/DAY value between the dates it was read and inserted in the et/day column.
I have entered in manually what I want in blue but need a formula to do this as too long to do all manually
You can do this with MATCH. With an ascending list, if you give the magic number 1 as the third parameter, it will show the last row number with a smaller or equal number.
Here it's matched 17 with 15 in column A and the result is 2, for row 2:
A
B
C
1
10
=MATCH(17,A:A,1) = 2
2
15
3
20
So for your data, you can match the daily dates with the column on the left, and feed the row number into INDEX to look up from the ET/Day column.
A
B
C
D
E
1
Date
ET/Day
Daily
ET/Day
2
05/Jan/1995
05/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = #N/A
3
19/Jan/1995
3.00
06/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 3.00
4
02/Feb/1995
5.41
07/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 3.00
5
...
...
6
19/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 3.00
7
20/Jan/1995
=Index(B:B, Match(#D:D,A:A,1)) = 5.41
There's an inconsistency here with the 05 Jan rate but it should be good after that.

Choosing the second highest row in an index set

Currently have a data set that looks like this
ID Function UniqueID
1 .8 11
1 .77 12
1 .75 13
2 .8 21
2 .8 22
2 .75 23
I am attempting to grab the first row of each "ID" set only when the second highest row in that ID set has a function value LESS THAN the highest row
In this instance I want output of
UniqueID: 11
With Excel 365, you could try
=LET(matches,MATCH(A2:A7,A2:A7,0),FILTER(C2:C7,(INDEX(B2:B7,matches)>INDEX(B2:B7,matches+1))*(ROW(A2:A7)-1=matches)*(COUNTIF(A2:A7,A2:A7)>1)))
assuming that the values are sorted in descending order in each ID group and that the data starts in row 2.
So this compares the value in the first row of each group with the value in the second row, selects only the first row of each group and also checks that there are at least two values in the group to compare.

Excel: find value in column, then search for date value in that row, return value to the left

I am looking for a formula (or code) that finds a value in a column, then find the value in that row between dates, when multiple dates return the max, then returning the value to the left. I cannot use a helper column. I tried a couple of nested index/match formula's but without success...
For the below example:
Parameter 1: Find Fork in Column A
Parameter 2: In that row (4), find date between: 1 Jan 18 AND 5 Jan 18
Parameter 3: when multiple dates are found in that date range, return the max
Parameter 4: Return the value from column left of that date
Result: black in Column D.
A B C D E F G
1 ID Colour 1Date 1 Colour 2Date 2 Colour 3 Date 3
2 Plate Green 1-Jan-18 Red 23-Jan-18 L blue 14-Feb-18
3 Bowl Blue 6-Jan-18 Brown 28-Jan-18 Yellow/Green 19-Feb-18
4 Fork Yellow 2-Jan-18 Black 4-Jan-18 Turquoise 24-Feb-18
5 Knive Purple 16-Jan-18 White 7-Feb-18 Maroon 1-Mar-18
6 Spoon Pink 21-Jan-18 Orange 12-Feb-18 L pink 6-Mar-18
I hope it is possible! Many many thanks in advance.
Try this
where
I10 = ID to search for
I11 = Min Date (1 Jan 2018)
I12 = Max Date (5 jan 2018)
J10 = =MATCH($I$10,$A$1:$A$6,0) get the row number if the ID
=INDEX(INDEX($A$1:$G$6,$J$10,),
MATCH(
MAXIFS(INDEX($A$1:$G$6,$J$10,),
INDEX($A$1:$G$6,$J$10,),">="&$I$11,
INDEX($A$1:$G$6,$J$10,),"<="&$I$12
),
INDEX($A$1:$G$6,$J$10,),0
) - 1
)
were
INDEX($A$1:$G$6,$J$10,)get the data row for the ID (repeated several time in formula)
MAXIFS(...) get the maximum date meeting the >= and <= criteria
MATCH(MAXIF(...), [ID data row],0) get the column number for the date returned by the MAXIF
INDEX( [ID data row], MATCH(MAXIF(...), [ID data row],0) - 1)returns the color
Alternative Formula without MAXIFS
=INDEX(INDEX($A$1:$G$6,$J$10,),
MATCH(
MAX(IFERROR(({0,0,1,0,1,0,1})*(INDEX($A$1:$G$6,$J$10,)>=$I$11)*(INDEX($A$1:$G$6,$J$10,)<=$I$12)*(INDEX($A$1:$G$6,$J$10,)),0)),
INDEX($A$1:$G$6,$J$10,),0
) - 1
)
Enter as an Array Formula (complete with CtrlShiftEnter rather than just Enter)

Conditional Formatting based on date and value in Excel

I am trying to return the color for a score based on the date for the score and the score itself. Scoring has used different cut-offs over time:
Table 1
Date1 Score Color
Sep-16 24 [should be red]
Jul-16 6 [should be green]
Apr-14 12 [should be yellow]
... ... ...
Table 2
Date2 Red Orange Yellow Green
Aug-16 20 15 9.5 0
Jul-16 20 15.5 9.5 0
Apr-16 20 15 9.5 0
Mar-15 19 14 7 0
Feb-15 20 13 8.5 0
Jan-15 19 14 7 0
Apr-14 19 14 7 0
I want to place a formula in the "Color" cell that will evaluate Table 2 and return the column name for instances where the date in date1 is the most recent instance where it is greater than date 2, and for which the score given on table 1 is equal to or larger than the score given on table 2 for the correct row.
Thanks,
You need nested approximate lookups. This would be easier if your data was sorted the other way around. At least table 2 should have the columns in ascending order, instead of descending, so the match function can return the correct position of the number with an approximate match.
If you can arrange the columns in Table2 in the order Date2, Green, Yellow, Orange, Red, then the following formula will be possible.
=INDEX(Table3[[#Headers],[Green]:[Red]],MATCH([#Score],INDEX(Table3[Green],IFERROR(MATCH([#Date1],Table3[Date2],-1),1)):INDEX(Table3[Red],IFERROR(MATCH([#Date1],Table3[Date2],-1),1)),1))
This uses structured references, which accommodates rows being inserted into the tables without breaking the formulas.
Now you can use conditional formatting based on the cell values in column C.
Just for comparison, I have chosen to keep the lookup table (in Sheet2 rather than in an actual table) the same as in the question i.e. both tables are sorted from largest to smallest or most recent to least recent and the MATCHes both have -1 as the third argument:-

Resources