Using Match function

sudeepdhar

New Member
Joined
Jun 14, 2010
Messages
6
Given a data range in ascending order(This condition cannot be changed), how can one use the match() function to find the row no. of a particular no. in the data range that is greater than or equal to the no. that is searched for.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Welcome to the board!

As you are probably aware, match(value,range,1) will look at the ascending range but will return the row number where it is equal to or LESS than the value you are looking for. This is depicted in the below screenshot in blue. You can adapt it by adding one to the row number, if the value found by match() is not equal to the value sought as shown in red:
Excel Workbook
ABCDE
1justusingmatchadaptingtogodownarow
22132
34363
46374
58
610
Sheet1
Cell Formulas
RangeFormula
C2=MATCH(D2,$A$2:$A$11,1)
E2=MATCH(D2,$A$2:$A$11,1)+IF(LOOKUP(D2,$A$2:$A$11)=D2,0,1)
 
Upvote 0
An alternative would be
PHP:
=MATCH(FALSE,$A$1:$A$5<C1,0)

Where A1:A5 contains the list to find the match, C1 contains the search value.

Confirmed as array formula with Shift Ctrl Enter
 
Upvote 0
The problem with the first solution is that the data you have chosen contains no.s that are different.In case the data is like 2,2,4,4,4,6,6,6,6,8,8,10 then going down a row will not help.
 
Upvote 0
The problem with the first solution is that the data you have chosen contains no.s that are different.In case the data is like 2,2,4,4,4,6,6,6,6,8,8,10 then going down a row will not help.

Value to be searched for: 5. What is the result you expect with respect to the sample you mention here?
 
Upvote 0
I would think you would want to return 6 if you searched for 5 and that data was 2,2,4,4,4,6,6,6,6,8,8,10... If that's true, then both solutions offered seem to work.

My guess is that my solution is significantly faster - but jasonb75's is definitely nicer to look at :p
 
Upvote 0

Forum statistics

Threads
1,215,127
Messages
6,123,203
Members
449,090
Latest member
bes000

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