INDEX MATCH MAX IF Function without the use of an array

FredericA

New Member
Joined
Mar 15, 2018
Messages
10
Can someone please help me with the following case:

A spreadsheet containing dates and values (multiple times same date is occuring):

A(date) B (Silo) C (lab value)
12.03.2018 15 30
12.03.2018 9 24
13.03.2018 9 27

If I fill in a new row with some numbers, it has to give me the most recent lab value from that silo, e.g.:
15.03.2018 15 has to return 30

I managed this using the following array function (CFE)
{=IFERROR(INDEX($C$10:$C173;MATCH(MAX(IF($B$10:$B173=$B174;$A$10:$A173));IF($B$10:$B173=$B174;$A$10:$A173);0));0)}

But I am struggeling to find the good form to execute this formula NOT as an array, I´d like to have it not as an array because the workbook will be shared and in that case each time you want to change or overwrite the formula you have to unshare.

Help would be really appreciated.
 
Ah ok sorry for not being clear, at the last row in my example I filled in 5 manually (the number of my Silo), so the formule is looking back in the data where he finds this 5 for the most recent date. In this example it is 3 rows above him at the 11th of March that the lab value in Silo 5 was 13,35, so this is the result of my formula
Even when the table is bigger and for example the 6th of March the lab value in Silo 5 was 12,9 it would not show this value as it looked for the most recent one.
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Yes indeed it's a date but excel just looks to it as a number I guess, so same dates are same numbers.
Don't bother about the 0 and 70, I was just adding these columns to form a calculation between with the value I am trying to get via that formula multiplied with the tons of product still in the silo and the new product with new lab value. But it does not affect my question posted here.
 
Upvote 0
9. Mrz. 18

is apparently 2018-03-09, right?

What do 0 and 70 mean which you show on row 11?

Yes indeed it's a date but excel just looks to it as a number I guess, so same dates are same numbers.
Don't bother about the 0 and 70, I was just adding these columns to form a calculation between with the value I am trying to get via that formula multiplied with the tons of product still in the silo and the new product with new lab value. But it does not affect my question posted here.

Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
I​
2​
2018-03-09
T5T3
14
13.32
6
7.3
1.5
3​
2018-03-10
T5T3
13
13.33
6
6.4
1
4​
2018-03-10
T5T3
9
13.24
6
7.5
9
5​
2018-03-10
T5T3
11
13.29
6.5
7.4
2
6​
2018-03-11
T5T3
7
13.24
6.5
7.7
0
7​
2018-03-11
T5T3
5
13.35
6
6.5
5
8​
2018-03-11
T5T3
3
13.27
6
6.4
34
9​
2018-03-12
T5T3
13
13.39
6
6.4
32.5
10​
11​
2018-03-13
T5T3
0
70
5
13.35​

In F11 just enter:

=LOOKUP(9.99999999999999E+307,1/(($E$2:$E$9=E11)*$A$2:$A$9),$F$2:$F$9)
 
Upvote 0
Wow genius, it works! Could you explain how it exactly works?

Thanks a lot in any case for taking the time to help!
 
Upvote 0
Wow genius, it works! Could you explain how it exactly works?

Thanks a lot in any case for taking the time to help!

Great to hear.

LOOKUP with that big number (a limit constant of Excel itself is used to pick out the last numerical value the array it's fed with.

Here we have a calculated numerical array, that is:

1/(($E$2:$E$9=E11)*$A$2:$A$9)

which multiplies the evaluation E2:E9 = E11 which yields TRUE or FALSE values.
Multiplying these TRUE/FALSE values pairwise with the numerical date range A2:A9 deliver a bunch of zeros and and non-zeros.
Note that TRUE * 2018-03-20 >> 2018-03-20 and FALSE * 2018-03-20.
Thus we get 0's and dates.

Dividing 1 by the set of 0's and dates gives a bunch of #DIV/0!'s and fractions (numbers).

LOOKUP with that big number picks out the last fraction from the division set and correlates its position within that set with a value in F2:F9 and returns that F value.

Hope this helps.
 
Upvote 0
You could try using SUMPRODUCT twice.

The formula I put in column C (cel C6) =SUMPRODUCT( (C$2:C5) * (B$2:B5 = B6) * (A$2:A5 = SUMPRODUCT( MAX( (A$2:A5) * (B$2:B5 = B6)))))

Let's start at the end formula: I start out by finding the latest date for the specific Silo. That formula is =SUMPRODUCT( MAX( (A$2:A5) * (B$2:B5 = B6))).
Then I use another SUMPRODUCT to find the right Lab value, for the Silo & the just calculated date. When you put it together you get the result.

You could also do this using a SUMIF formula. Then the formula for cell C6 should be:
=SUMIFS( C$2:C5, B$2:B5, B6, A$2:A5, SUMPRODUCT( MAX( (A$2:A5) * (B$2:B5 = B6)))).


I'm using setup:
A(date)B(Silo)C (lab value)
12/03/20181530
12/03/2018924
13/03/20181530
13/03/2018927
15/03/20181530,00


<colgroup><col><col span="2"></colgroup><tbody>
</tbody>

Hope that works!
Rick
 
Last edited:
Upvote 0
Nice alternative, this will work for sure too, thanks! Is there anywhere info on what calculations are using the most CPU and thus making your file more heavy if you have over 1000 cells containng such formulas?
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,607
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top