Finding the time value closest to zero (with 1904 date system)

Joe94

New Member
Joined
Nov 19, 2010
Messages
20
I am trying to find a formula that, for each row, will display the value of the cell which is closest to 0. In order to use negative time values I have had to use the 1904 date system which I believe is disrupting the results when Excel calculates the minimum value. I have currently tried something like =MIN(ABS(A1),ABS(A2)) but this is not working. Does anyone have any suggestions as to how I can go about fixing this?

AB
00:00:50.79900:00:50.305
00:00:00.24200:00:00.000
-00:00:00.860-00:00:00.473
-00:00:01.034-00:00:00.188
-00:00:01.266-00:00:00.422
-00:00:00.59800:00:00.409

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Thanks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Maybe

C1 copied down
=MIN(0+SUBSTITUTE(A1,"-",""),0+SUBSTITUTE(B1,"-",""))

format the results: hh:mm:ss.000

M.
 
Upvote 0
What's wrong with =MIN(ABS(A1),ABS(B1)) ?
In your example,I replaced A2 with B1 as you stated you are looking for the closest to zero for each row
Or are they text looking like numbers?
 
Last edited:
Upvote 0
Thanks for your replies.

The values are currently already in the format hh:mm:ss.000. Although the values look as I have put above, in the formula bar the top row reads as:

00:00:5102/01/1904 00:00:50

<tbody>
</tbody>

so when I press "Show Formulas" they become:

0.0005879513888888891.0005787037037

<tbody>
</tbody>
which is why I assume the minimum function isn't working. As I said previously, the 1904 date format was used to allow negative time values.

Hope this clears things up.

Thanks
 
Last edited:
Upvote 0
Oh and I forgot to say but Marcelo your suggestion didn't work sadly.

hmm...worked for me (my Excel version uses comma as decimal separator)


A
B
C
1
00:00:50,799​
00:00:50,305​
00:00:50,305​
2
00:00:00,242​
00:00:00,000​
00:00:00,000​
3
-00:00:00,860​
-00:00:00,473​
00:00:00,473​
4
-00:00:01,034​
-00:00:00,188​
00:00:00,188​
5
-00:00:01,266​
-00:00:00,422​
00:00:00,422​
6
-00:00:00,598​
00:00:00,409​
00:00:00,598​

M.
 
Upvote 0
There must be something wrong with my data then I'll have to investigate further. Thanks for your help anyway.
 
Upvote 0
This worked fine for me:

A​
B​
C​
D​
2​
00:00:50.799​
00:00:50.305​
00:00:50.305​
C2: =IF(ABS(A2) < ABS(B2), A2, B2)
3​
00:00:00.242​
00:00:00.000​
00:00:00.000​
4​
00:00:00.860​
-00:00:00.473​
-00:00:00.473​
5​
-00:00:00.860​
-00:00:00.473​
-00:00:00.473​
6​
-00:00:01.034​
-00:00:00.188​
-00:00:00.188​
7​
-00:00:01.266​
-00:00:00.422​
-00:00:00.422​
8​
-00:00:00.598​
00:00:00.409​
00:00:00.409​

It might be easier to convert everything to decimal seconds.
 
Upvote 0
This worked fine for me:

A​
B​
C​
D​
2​
00:00:50.799​
00:00:50.305​
00:00:50.305​
C2: =IF(ABS(A2) < ABS(B2), A2, B2)
3​
00:00:00.242​
00:00:00.000​
00:00:00.000​
4​
00:00:00.860​
-00:00:00.473​
-00:00:00.473​
5​
-00:00:00.860​
-00:00:00.473​
-00:00:00.473​
6​
-00:00:01.034​
-00:00:00.188​
-00:00:00.188​
7​
-00:00:01.266​
-00:00:00.422​
-00:00:00.422​
8​
-00:00:00.598​
00:00:00.409​
00:00:00.409​

<tbody>
</tbody>


It might be easier to convert everything to decimal seconds.

Weird, didn't work for me (comma as decimal separator)


A
B
C
1
2
00:00:50,799​
00:00:50,305​
00:00:50,305​
3
00:00:00,242​
00:00:00,000​
00:00:00,000​
4
-00:00:00,860​
-00:00:00,473​
#VALOR!​
5
-00:00:01,034​
-00:00:00,188​
#VALOR!​
6
-00:00:01,266​
-00:00:00,422​
#VALOR!​
7
-00:00:00,598​
00:00:00,409​
#VALOR!​

M.
 
Upvote 0
Marcelo, try entering negative times as, for example

=-"00:00:00,473"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,328
Messages
6,124,295
Members
449,149
Latest member
mwdbActuary

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