ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How is time represented? How do i make an equation representing 5 minutes? (https://www.excelbanter.com/excel-programming/312908-how-time-represented-how-do-i-make-equation-representing-5-minutes.html)

R

How is time represented? How do i make an equation representing 5 minutes?
 
Fist off, big thanks to Chip Pearson who answered my last querry here
with a pointer to his site-- great stuff there, thanks!

Here is my next problem-- simple I am sure, but i haven't a clue...

In Cell e1 I have a time, in one of the standard time formats. I need
to run some code if the current time is at least 5 minutes later than
the time in e1.

The IF, THEN statement seems obvious enough, but what goes in the
place of the question marks below? Does each numeral equal a second,
so for 5 minutes it would be 60*5, or 300? Apparently not, 300 doesn't
= 5 minutes I have fingured out through trial and error.... So what
should go in place of the question marks below to equal 5 minutes??
Arggg!!!! Thanks in advance for the help and/or explanation!

If (Now() (e1 + ????)) Then

Norman Jones

How is time represented? How do i make an equation representing 5 minutes?
 
Hi R,

1 Day = 24 Hours
1 Hour = 60 Mins

Therefo

5 Mins = (1/24/60)*5

---
Regards,
Norman



"R" wrote in message
...
Fist off, big thanks to Chip Pearson who answered my last querry here
with a pointer to his site-- great stuff there, thanks!

Here is my next problem-- simple I am sure, but i haven't a clue...

In Cell e1 I have a time, in one of the standard time formats. I need
to run some code if the current time is at least 5 minutes later than
the time in e1.

The IF, THEN statement seems obvious enough, but what goes in the
place of the question marks below? Does each numeral equal a second,
so for 5 minutes it would be 60*5, or 300? Apparently not, 300 doesn't
= 5 minutes I have fingured out through trial and error.... So what
should go in place of the question marks below to equal 5 minutes??
Arggg!!!! Thanks in advance for the help and/or explanation!

If (Now() (e1 + ????)) Then




R

How is time represented? How do i make an equation representing 5 minutes?
 
Hmmm, thanks Norman, but maybe I am missing something!

When I plug that in, or (.003472222) the If, THEN doesn't work at all.
If in E1 I have "Oct 7, 2004 11:10 pm" and I use:

If (Now() (e1 + (.003472222)) Then Do xyz

It will do xyz even if the time NOW() = "Oct 7, 2004 11:12"

I need it to only do xyz if the time is 5 minutes later than E1, or
AFTER "Oct 7, 2004 11:15 pm" in this example....

Sorry if I am thick trying to figure this out, I am pretty new to VBA
and am honsetly kind of lost here.


On Fri, 8 Oct 2004 03:54:58 +0100, "Norman Jones"
wrote:

Hi R,

1 Day = 24 Hours
1 Hour = 60 Mins

Therefo

5 Mins = (1/24/60)*5

---
Regards,
Norman



"R" wrote in message
.. .
Fist off, big thanks to Chip Pearson who answered my last querry here
with a pointer to his site-- great stuff there, thanks!

Here is my next problem-- simple I am sure, but i haven't a clue...

In Cell e1 I have a time, in one of the standard time formats. I need
to run some code if the current time is at least 5 minutes later than
the time in e1.

The IF, THEN statement seems obvious enough, but what goes in the
place of the question marks below? Does each numeral equal a second,
so for 5 minutes it would be 60*5, or 300? Apparently not, 300 doesn't
= 5 minutes I have fingured out through trial and error.... So what
should go in place of the question marks below to equal 5 minutes??
Arggg!!!! Thanks in advance for the help and/or explanation!

If (Now() (e1 + ????)) Then




Norman Jones

How is time represented? How do i make an equation representing 5 minutes?
 
Hi R,

In VBA. try:

If Now Range("E1").Value + TimeSerial(0, 5, 0) Then


---
Regards,
Norman



"R" wrote in message
...
Hmmm, thanks Norman, but maybe I am missing something!

When I plug that in, or (.003472222) the If, THEN doesn't work at all.
If in E1 I have "Oct 7, 2004 11:10 pm" and I use:

If (Now() (e1 + (.003472222)) Then Do xyz

It will do xyz even if the time NOW() = "Oct 7, 2004 11:12"

I need it to only do xyz if the time is 5 minutes later than E1, or
AFTER "Oct 7, 2004 11:15 pm" in this example....

Sorry if I am thick trying to figure this out, I am pretty new to VBA
and am honsetly kind of lost here.


On Fri, 8 Oct 2004 03:54:58 +0100, "Norman Jones"
wrote:

Hi R,

1 Day = 24 Hours
1 Hour = 60 Mins

Therefo

5 Mins = (1/24/60)*5

---
Regards,
Norman



"R" wrote in message
. ..
Fist off, big thanks to Chip Pearson who answered my last querry here
with a pointer to his site-- great stuff there, thanks!

Here is my next problem-- simple I am sure, but i haven't a clue...

In Cell e1 I have a time, in one of the standard time formats. I need
to run some code if the current time is at least 5 minutes later than
the time in e1.

The IF, THEN statement seems obvious enough, but what goes in the
place of the question marks below? Does each numeral equal a second,
so for 5 minutes it would be 60*5, or 300? Apparently not, 300 doesn't
= 5 minutes I have fingured out through trial and error.... So what
should go in place of the question marks below to equal 5 minutes??
Arggg!!!! Thanks in advance for the help and/or explanation!

If (Now() (e1 + ????)) Then






R

How is time represented? How do i make an equation representing 5 minutes?
 
Wow!!! Perfect!! Thanks so much Norman-- really mega thanks, you have
no idea how much i appreciate your help! It works, it works!! YEAH!!!

On Fri, 8 Oct 2004 04:44:14 +0100, "Norman Jones"
wrote:

Now Range("E1").Value + TimeSerial(0, 5, 0)




All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com