Using IF to compare time values

Solved/Closed
keh_2878 Posts 2 Registration date Sunday December 8, 2019 Status Member Last seen December 9, 2019 - Dec 8, 2019 at 06:21 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Dec 10, 2019 at 11:51 AM
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
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Dec 9, 2019 at 12:09 PM
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
keh_2878 Posts 2 Registration date Sunday December 8, 2019 Status Member Last seen December 9, 2019
Dec 9, 2019 at 03:44 PM
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.
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Dec 10, 2019 at 11:51 AM
Nice!