MATCH()

garyfritz

New Member
Joined
Apr 30, 2011
Messages
20
I have some very strange MATCH() behavior. I've narrowed it down to a very simple case. In the attached image, columns A-D are all just constants. F1 is =LARGE(A1:D1,1) and G1 is =MATCH(LARGE(A1:D1,1),A1:D1), and those formulas are copied down the columns.

You can see that the LARGE() in col F is working just fine. For example, F1 says the largest value is 1.0263. But G1, which contains =MATCH(LARGE(A1:D1,1),A1:D1), says column 4 matches that largest value!? G2:G6 are correct, then G7:G9 are wonky again, and so on. In all those cases, column 1 is actually the largest value.

It also sometimes selects the wrong column if I ask for the 2nd-largest value. If I ask for 3rd-largest I get #N/A in rows 1 and 7-9 (same as the erroneous rows before). If I ask for 4th largest, all cells are #N/A except row 11, which correctly says column 4 is 4th largest.

Am I doing something obviously wrong here ??

1621115036794.png
 

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.
change
Code:
=MATCH(LARGE(A1:D1,1),A1:D1)
to
Code:
=MATCH(LARGE(A1:D1,1),A1:D1,0)
 
Upvote 0
Solution
Ahhh. I didn't notice that the default requires the array to be in sorted order. Match type 0 works like a charm. Thanks!
 
Upvote 0
How about?

Book1
ABCDEFG
1Position 1Position 2Position 3Position 4Highest amtRank
21105100981052
3988568589881
448987985789872
Sheet1
Cell Formulas
RangeFormula
F2:F4F2=LARGE(A2:D2,1)
G2:G4G2=MATCH(LARGE(A2:D2,COLUMN(A2:D2)-COLUMN($A2)+1),A2:D2,0)
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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