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
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

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,689

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!).
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,606
Messages
5,838,343
Members
430,538
Latest member
PedroOliveira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top