Using IF to compare time values [Solved]

Report
Posts
2
Registration date
Sunday December 8, 2019
Status
Member
Last seen
December 9, 2019
-
Posts
2656
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 17, 2020
-
Hello,


So basically I have a huge column of time values (00-00-00 format) and I am trying to write a code that takes the time in one cell (B) and compares it to the time in the cell before (A). If the time in B is more than 1 second later than the time in A, I want it to return the number 1 in the adjacent column. If the time in B is 1 second or less than the time in A, I want the adjacent cell to remain blank.

I have tried using the IF and SUM function together but it is not working and I cant figure it out.
=IF(B2>SUM(B1+TIMEVALUE("00:00:01")),1,)

Thank you.


System Configuration: Windows / Edge 18.18362

1 reply

Posts
2656
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 17, 2020
440
Hi Keh,

It works for me, at least after matching your query with the formula:
=IF(B1>SUM(A1+TIMEVALUE("00:00:01")),1,"")

Comparing column A to B and leaving the cell blank, when condition is not met.

Does it work now?

Best regards,
Trowa
Posts
2
Registration date
Sunday December 8, 2019
Status
Member
Last seen
December 9, 2019

Thank you! It works now. My problem was that I was trying to compare time values to each other within a single column. Once I added in another column to compare to it ran fine.
Posts
2656
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 17, 2020
440
Nice!