Index Match Multiple Columns

Noz2k

Well-known Member
Joined
Mar 15, 2011
Messages
693
So I have a formula at the moment, which searches for a match with some given criteria, but only in column C, I'd like it to also look in column D, and return if either C or D match.

Excel Formula:
=iferror(INDEX('Fixtures & Results'!A:A,XMATCH(1,('Fixtures & Results'!B:B>=TODAY())*('Fixtures & Results'!C:C=E2),0,1)),"n/a")
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try

Excel Formula:
=INDEX(FILTER('Fixtures & Results'!A:A,(('Fixtures & Results'!B:B>=TODAY())*(('Fixtures & Results'!C:C=E2)+('Fixtures & Results'!D:D=E2)),"n/a"),1)

Also, try reducing the range sizes to something realistically proportionate to the amount of data in your sheet. Full column formulas are far from efficient and using TODAY() makes it volatile which is even worse. Do you notice delay while it calculates every time you change something in your sheet?
 
Upvote 0
Thanks, I tried it, but it returns as an Error.

Also tried encapsulating it in an OR
Excel Formula:
OR(('Fixtures & Results'!C:C=E2),('Fixtures & Results'!D:D=E2))
but it doesn't like that either.

The range sizes are set as such because the number of rows can be added to by the front end, and at the moment at least it isn't noticeably delaying anything, calculations are pretty instantaneous.
 
Upvote 0
Sorry, too many parentheses. Copying and pasting from your formula then editing it, I left one in that should have been removed.

Excel Formula:
=INDEX(FILTER('Fixtures & Results'!A:A,('Fixtures & Results'!B:B>=TODAY())*(('Fixtures & Results'!C:C=E2)+('Fixtures & Results'!D:D=E2)),"n/a"),1)
 
Upvote 0
That returned n/a, as I think you had a bit of my iferror left in there. Changed it slightly though and got it working from your formula, so massive help, thank you.

Excel Formula:
=iferror(INDEX(FILTER('Fixtures & Results'!A:A,('Fixtures & Results'!B:B>=TODAY())*(('Fixtures & Results'!C:C=E2)+('Fixtures & Results'!D:D=E2))),1),"n/a")
 
Upvote 0
Solution
Not critical as you have it doing what you need anyway but it should have worked correctly as it was, the "n/a" that I left in should only be shown when there are no results, so it should do the same as, and shouldn't need IFERROR.

If you do find it getting slow then this should help, it starts by finding the last row with a date in column B, then only process up to that point instead of including the empty rows below.
Excel Formula:
=LET(lr,MATCH(1E+100,$B:$B),rng,$A$2:INDEX($D:$D,lr),INDEX(FILTER(rng A:A,(rng B:B>=TODAY())*((rng C:C=E2)+(rng D:D=E2)),"n/a"),1))
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Thank you for the help in optimising, that is useful to know for the future anyway regardless if I use it for this specific instance.

It shouldn't have produced n/a though because there are definitely results which match the criteria in the dataset (that are now showing).
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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