How to use index and arrays for a nested query?

annechez

New Member
Joined
Apr 11, 2009
Messages
27
Hi,

I have a table as follows:

I am trying to return the latest date for a given Fruit and Type - can anyone help.

i.e. Pear with a Type of AI_646 should return a date of 10/10/2020.

Can anyone help.

I have to use my work version of Excel which is Office 2010, so I can't use the latest features.

Any guidance would be amazing, I'm going round in circles and never coming out with the correct answer!

FruitTypeDate
AppleAI_840
10/03/2020​
PearAI_646
01/03/2020​
PearAI_840
12/12/2020​
AppleAI_121
05/05/2020​
OrangeAI_123
06/06/2020​
PearAI_646
10/10/2020​
PearAI_646
07/09/2020​
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
MrExcel.xlsx
ABCDEFG
1FruitTypeDateFruitTypeLatest Date
2AppleAI_8402020/3/10PearAI_6462020/10/10
3PearAI_6462020/3/1
4PearAI_8402020/12/12
5AppleAI_1212020/5/5
6OrangeAI_1232020/6/6
7PearAI_6462020/10/10
8PearAI_6462020/9/7
Sheet6
Cell Formulas
RangeFormula
G2G2=MAX((A2:A8=E2)*(B2:B8=F2)*C2:C8)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
That's fantastic, thank you.

If I wanted to extend the above nd return the value in the "Notes" column for a latest date of a Pear, of Type AI_646 (i.e. return fff), what would I do?

FruitTypeDateNotes
AppleAI_840
10/03/2020​
aaa
PearAI_646
01/03/2020​
bbb
PearAI_840
12/12/2020​
ccc
AppleAI_121
05/05/2020​
ddd
OrangeAI_123
06/06/2020​
eee
PearAI_646
10/10/2020​
fff
PearAI_646
07/09/2020​
ggg
 
Upvote 0
Apologies - I don't think I was very clear in my ask above.

What I'm looking for is return the contents of cell D7 (fff in my example above) If I have the conditions latest date, Pear and AI_646

??
 
Upvote 0
I should say sorry, please see if below formula works:
MrExcel.xlsx
ABCDEFGH
1FruitTypeDateNotesFruitTypeNotes
2AppleAI_8402020/3/10APearAI_646F
3PearAI_6462020/3/1B
4PearAI_8402020/12/12C
5AppleAI_1212020/5/5D
6OrangeAI_1232020/6/6E
7PearAI_6462020/10/10F
8PearAI_6462020/9/7G
Sheet6
Cell Formulas
RangeFormula
H2H2=INDEX(D:D,MOD(MAX((A$2:A$8=F2)*(B$2:B$8=G2)*(C$2:C$8*10^4+ROW(2:8))),10^4))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Totally - amazing and it really helps me out. Thank you.

Although I must say, I'm not entirely show how it does it... my mind has been blown :)
 
Upvote 0

Forum statistics

Threads
1,214,517
Messages
6,119,984
Members
448,935
Latest member
ijat

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