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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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:
Upvote 0
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.
 
Upvote 0
... and you also recalculated of course, didn't you?
 
Upvote 0
Yep, I posted without thinking. See jonmo1's suggestion (and his signature!).
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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
Back
Top