nearest time value to 00:00

sophiabc1

New Member
Joined
Apr 15, 2013
Messages
9
Excel 2010. I have two columns in each row for time, in hh:mm, and would like to know how to get a third column to display whichever of the first two values is nearest to 00:00. The first two columns have negative time values too (ie. they represent time before and after High Tide). for example,
02:46-09.39display here the time (with sign) nearest to 00:00 (should be 02:46)
-01:2308:35(should be -01:23)
02:30-09.25(should be 02:30)

<tbody>
</tbody>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Assuming your times as text

A B C
02:46
-09:39
02:46
-01:23
08:35
-01:23
02:30
-09:25
02:30

<tbody>
</tbody>


Array formula in C1
=INDEX(A1:B1,MATCH(MIN(SUBSTITUTE(A1:B1,"-","")+0),SUBSTITUTE(A1:B1,"-","")+0,0))

confirmed with Ctrl+Shift+Enter simultaneously
(hold down both Ctrl and Shift keys and hit Enter)

copy down

M.
 
Upvote 0
Thank you both for your answers. Marcelo's formula worked for me, as I've just realised my two time columns were actually text (as I had used a formula in both those to get 'time' values, which were from real time values in previous columns! Apologies Andrew). Thanks again, Sophia
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
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