×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Excel VBA Evaluate Data/Time stamp

Excel VBA Evaluate Data/Time stamp

Excel VBA Evaluate Data/Time stamp

(OP)
Hello,

The solution to my problem may be elementary, but I am just not finding it. I am looking for records that show that process is automatically repeating. So, I am looking at data/time stamps, and I am trying to flag any record which matches a previous record within 2 seconds of its date/timestamp.

EXAMPLE:

For i = 2 To 25000
((variable2)) ((variable1 + 2 seconds))
If 7/18/2018 13:00:01 <= (7/18/2018 13:00:00 + 2 seconds) Then
Perform tasks to mark record
End If
Next

Can anyone tell me how to evaluate the timestamp this way?

Thank you in advance!

RE: Excel VBA Evaluate Data/Time stamp

Hi,

CODE

For i = 2 To 25000
   If Abs(Cells(i, "A").Value - Cells(i + 1, "A").Value) < TimeSerial(0,0,2) Then...
Next 
...assuming column A has time values.
Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Excel VBA Evaluate Data/Time stamp

(OP)
Thank you, Skip! Very helpful!!

RE: Excel VBA Evaluate Data/Time stamp

this can also be done in a Conditional Format, top of selection A2...

=OR(ABS(A1-A2)<TIME(0,0,2),ABS(A2-A3)<TIME(0,0,2))

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close