ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Finding a close match (https://www.excelbanter.com/excel-discussion-misc-queries/204435-finding-close-match.html)

mailrail

Finding a close match
 
I have four time values in a row. The first value is a specific chosen time
value. The next three are demonstrated times. I need to find the closest
match of the three demonstrated times to the first column. Any help?

Peo Sjoblom

Finding a close match
 
One way


=INDEX(B1:D1,MATCH(MIN(IF(ABS(B1:D1-A1)=MIN(ABS(B1:D1-A1)),B1:D1)),B1:D1,0))


entered with ctrl + shift & enter

where B1:D1 are the 4 values and A1 the chosen value



--


Regards,


Peo Sjoblom





"mailrail" wrote in message
...
I have four time values in a row. The first value is a specific chosen time
value. The next three are demonstrated times. I need to find the closest
match of the three demonstrated times to the first column. Any help?




Peo Sjoblom

Finding a close match
 
Meant where B1:D1 are the 3 demonstrated values


--


Regards,


Peo Sjoblom



"Peo Sjoblom" wrote in message
...
One way


=INDEX(B1:D1,MATCH(MIN(IF(ABS(B1:D1-A1)=MIN(ABS(B1:D1-A1)),B1:D1)),B1:D1,0))


entered with ctrl + shift & enter

where B1:D1 are the 4 values and A1 the chosen value



--


Regards,


Peo Sjoblom





"mailrail" wrote in message
...
I have four time values in a row. The first value is a specific chosen
time
value. The next three are demonstrated times. I need to find the closest
match of the three demonstrated times to the first column. Any help?






ShaneDevenshire

Finding a close match
 
Hi,

Here is another solution:

=INDEX(T,MATCH(MIN(ABS(T-A1)),ABS(T-A1),0))

I have named the range A2:A4, where your three demonstration times are, T.
You don't need to use the name, just substitute the address. A1 is the cell
containing the time you want to check.

This formula is an array, which means you must press Shift+Ctrl+Enter to
enter it.

Remember to format the cell to a time format.

--
Thanks,
Shane Devenshire


"mailrail" wrote:

I have four time values in a row. The first value is a specific chosen time
value. The next three are demonstrated times. I need to find the closest
match of the three demonstrated times to the first column. Any help?



All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com