Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

In attached, top table should match the values of bottom table.

I know I'm mostly right, but can't crack it.

QueryTable.xlsm

I know I'm mostly right, but can't crack it.

QueryTable.xlsm

=INDEX(otr!$A$3:$I$42,MATC

confirmed with CTRL+SHIFT+ENTER and copied down column

regards, barry

=INDEX(otr!$A$3:$I$42,MATC

Note that if you take the max date for "Issue" and the max date for "Maturity" theoretically they might not belong to the same row. My suggested N18 formula just matches the max Issue date - if you want you can match both with this version

=INDEX(otr!$A$3:$I$42,MATC

In this sample it gives you the same results as the previously suggested N18 formula, but depending on your data it may not do so (and may even return #N/A if there is no matching row).

regards, barry

The attached has two versions. The first (yellow) uses a helper column ("Row") to find the relevant row...

```
=OFFSET($A$1,$Q18-1,MATCH(N$17,$A$1:$I$1,0)-1)
```

...and the helper...
```
{=MIN(IF($A$3:$A$42&":"&$D$3:$D$42=$M18&":"&MAX(IF($A$3:$A$42=$M18,$D$3:$D$42)),ROW($A$3:$A$42),9^10))}
```

The second version (red) doesn't use a helper...
```
=OFFSET($A$1,MIN(IF($A$3:$A$42&":"&$D$3:$D$42=$M38&":"&MAX(IF($A$3:$A$42=$M38,$D$3:$D$42)),ROW($A$3:$A$42),9^10))-1,MATCH(N$17,$A$1:$I$1,0)-1)
```

Regards,Brian.QueryTable-V2.xlsm

@redmond, yours works consistently, but do you think it's possible to just use index/match/max combo, like what I was trying to attempt?

I'm sorry that mine wasn't what you wanted, but, trust me, it would be a complete waste of your time and mine to work on it while Barry's involved!

Regards,

brian.

Which version of Excel are you using?

If the answer is Excel 2010 or later, then you can use the AGGREGATE function. It will let you create a formula that has the benefits of Boolean expressions without needing to be array-entered. Here is a formula for P18 that you may copy both across and down:

=AGGREGATE(14,6,INDEX(otr!

The first parameter (14) means to find the largest values. The last parameter (1) means to find the first largest value. The combination is equivalent to MAX. The second parameter (6) means to ignore error values (the Boolean expression returns an error value if no match in column A for M18).

Brad

The circular reference was because formula should look in the main data table, and copied across, so when I put it in O18, it referenced itself.

While I don't fully understand the Match nesting, I can 'see' that it is acting on the max of Issue date and lookup value.

@ red, yours also works perfect, just less intuitive for me to understand.

@ byundt, thanks, using 2007, but good to know!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

=INDEX(otr!$A$3:$I$42,MATC

It doesn't use MAX but it uses the result from O18 so it is using MAX indirectly because that is used in O18.

Where do you get a circular reference?

Perhaps you can replace O18 with the MAX(IF part, i.e.

=INDEX(otr!$A$3:$I$42,MATC

regards, barry