MATCH function.

ashliiii

Board Regular
Joined
Feb 27, 2011
Messages
69
Suppose I have in cells A1 to A5, values, 8, 6, 7, 6, 5.

In cell B1, I have the following equation:

=match(A1, A$1:A$5, 0)

which I copy and paste in cells B2 to B5.

Then, the values in cells B1 to B5, are 1, 2, 3, 2, 5.

My question is, since 6 is repeated in cells A2 and A4, how should the formula in col B be modified so that I get values 1, 2, 3, 4, 5 in cells B1 to B5.

Thankyou
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
So is it just the row number you are looking for?

If so...

Highlight B1:5

& in B1 type

=ROW(1:5)

Confirmed with Crtl+Shift+Enter

Regards

Roger
 
Upvote 0
How does Excel know that the 6 in A2 is different from the 6 in A4 ?

All you're asking is for it to find 6, and that's exactly what it's doing.
 
Upvote 0
The example I had is a simple Excel sheet to show what I wanted to achieve.

How can I modify the match function so that it can distinguish between repeated values such as the value 6.

I have a worksheet that I record the miles walked on the treadmill each day for the past 8 years or so. I wrote a "large" function to get the amounts walked, sorted highest to lowest and a "match" function to find the corresponding row number. As is, when there are repeated vlaues for the miles walkes, the match function cannot distinguish between the repeated values. This is my question?

Appreciate the help.
 
Upvote 0
The example I had is a simple Excel sheet to show what I wanted to achieve.

How can I modify the match function so that it can distinguish between repeated values such as the value 6.

I have a worksheet that I record the miles walked on the treadmill each day for the past 8 years or so. I wrote a "large" function to get the amounts walked, sorted highest to lowest and a "match" function to find the corresponding row number. As is, when there are repeated vlaues for the miles walkes, the match function cannot distinguish between the repeated values. This is my question?

Appreciate the help.

Let A2:A10 house the treadmill values.

B2 enter and copy down:

=IF(ROWS($B$2:B2)<=ROWS($A$2:$A$10),LARGE($A$2:$A$10,ROWS($B$2:B2)),"")

C2, control+shift+enter, not just enter, and copy down:

=IF(ISNUMBER($B2),SMALL(IF($A$2:$A$10=$B2,ROW($A$2:$A$10)),COUNTIF($B$2:B2,B2)),"")

The latter will yield the native row numbers that correspond to the values,
sorted with the LARGE function.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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