if function which run off the time?

zilch4ry

Board Regular
Joined
Feb 27, 2011
Messages
76
Hi all,

I've been trying to create an =if formula which runs off an =now formula. The question i have is if anybody could help me produce a if function which states when an =now() displays the times between 18:00 and 20:00 a £5 deduction is taken from an overal price, but when its any other time the deduction is simply 0.

I will be able to deduct the amount from the total value its just i can't seem to tell the if function to look for only the times between and including 18:00 and 20:00.

If anybody could help me with this or state a way it can be done will be very appreciated.

Thanks in advance,


Tom
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Well, you have to consider the date as well, becuase NOW() = Date AND Time.


Try

=IF(AND(A1-INT(A1)>="18:00:00"+0,A1-INT(A1)<="20:00:00"+0),5,0)
Where A1 : =NOW()
 
Last edited:

zilch4ry

Board Regular
Joined
Feb 27, 2011
Messages
76
Thanks for taking the time to answer VoG, but it doesn't seem to work. I did change the A1 cells to the cell on my spreadsheet which contains the =NOW() formula (cell G31), and also changed the time on my laptop to 18:50 (which is between the time gap) but it just doesn't seem to work.
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,402

ADVERTISEMENT

... and you also recalculated of course, didn't you?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Yep, I posted without thinking. See jonmo1's suggestion (and his signature!).
 

Watch MrExcel Video

Forum statistics

Threads
1,109,545
Messages
5,529,458
Members
409,879
Latest member
Aussie_Excel_Wanna_Be
Top