unique closest match formula

epactheactor

New Member
Joined
Sep 9, 2015
Messages
38
Hello!

I have 2 columns of data;

Mile numberStop sign's mile number
111150
123159
151160
152
160
165
171
176
178

<tbody>
</tbody>

I'm wanting to create a formula which would show/count the closest match of the signs to the mile number.
It would look like this;

Mile numberSignsSign's mile number
1110150
1230159
1511160
1520
1602
1650
1710
1760
1780

<tbody>
</tbody>

I'm attempted to use Match and Index, but it isn't working for me. Here's what I've worked out so far.

=(IF(INDEX(FC,MATCH(MIN(ABS(FC-E480)),ABS(FC-E480),))>E480,"",1)) Where FC is the range.

Is such a formula even possible?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Why is the answer "2" for mile 160 ?

Is it because the 2nd sign is closer to mile 160 than any other mile number ?
Or is it because there are 2 signs that are close to mile 160 ?
 
Upvote 0
how about something like this adjusting ranges to suit.

=IF(NOT(ISNUMBER(A1)),COUNTIF($C$2:$C$4,"<="&A2),IF(NOT(ISNUMBER(A3)),COUNTIF(C1:C3, ">=" & A2),COUNTIFS($C$2:$C$4,">="&((A2-A1)/2)+A1,$C$2:$C$4,"<"&((A3-A2)/2)+A2)))

Also Gerald i got curious and tested your signature. Its awesome.
 
Last edited:
Upvote 0
Forgot to fix one of my ranges:

=IF(NOT(ISNUMBER(A1)),COUNTIF($C$2:$C$4,"<="&A2),IF(NOT(ISNUMBER(A3)),COUNTIF($C$2:$C$4, ">=" & A2),COUNTIFS($C$2:$C$4,">="&((A2-A1)/2)+A1,$C$2:$C$4,"<"&((A3-A2)/2)+A2)))
 
Upvote 0
Looking at this again today, i made a small mistake which i've now corrected if you are using this.

=IF(NOT(ISNUMBER(A1)),COUNTIF($C$2:$C$4,"<"&((A3-A2)/2)+A2),IF(NOT(ISNUMBER(A3)),COUNTIF($C$2:$C$4, ">=" & ((A2-A1)/2)+A1),COUNTIFS($C$2:$C$4,">="&((A2-A1)/2)+A1,$C$2:$C$4,"<"&((A3-A2)/2)+A2)))
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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