IF DATE and TIME

AtTcQ

New Member
Joined
Jan 10, 2020
Messages
15
Office Version
  1. 2019
Platform
  1. Windows
I currently use this to check if date has passed but i also need to set a time on it too. Is it possible?

VBA Code:
=IF(B:B>TODAY(),"Not Passed","Passed")
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
excel.gif
 
Upvote 0
As you can see EVENT 5 should say not passed TIMEVALUE doesnt seem to work
 
Upvote 0
You could upload to a file sharing site and post the link in the thread but it is preferred that you have the data actually in the thread as some people can't/won't download files so you are restricting who will look at your post.
see the link below about the 2 squares.

2 Squares

Please don't post images as we can't copy/paste them into Excel and it is a pain retyping data (and I often won't). I also can't see your times in column B in your post.
 
Upvote 0
That is weird how come explorer causes that

Book1
ABCDE
1EVENT 401/01/2020PASSED
2EVENT 512/01/2020NOT PASSED
3EVENT 611/01/2020PASSEDWITH TIMECURRENT TIMEDATE 11/01/2020 00:57
Sheet1
Cell Formulas
RangeFormula
C1, C3C1=IF(B1>TODAY()+TIMEVALUE("10:00"),"NOT PASSED","PASSED")
C2C2=IF(B:B>TODAY(),"NOT PASSED","PASSED")
 
Upvote 0
As you can see EVENT 5 should say not passed TIMEVALUE doesnt seem to work
It does in what you posted :unsure: by the way you have =IF(B:B>TODAY(),"NOT PASSED","PASSED") in the cell not =IF(B2>TODAY(),"NOT PASSED","PASSED")

For me it comes out as
Book1
ABC
1EVENT 401/01/2020PASSED
2EVENT 512/01/2020NOT PASSED
3EVENT 611/01/2020PASSED
Sheet4
Cell Formulas
RangeFormula
C1:C3C1=IF(B1>TODAY()+TIMEVALUE("10:00"),"NOT PASSED","PASSED")


Which is correct as 12/01/2020 00:00 is later that 11/01/2020 10:00
 
Last edited:
Upvote 0
Sorry i meant event 6. I have updated to make it clearer.

Book1
ABCDEF
1EVENT 401/01/20208:00:00 PMPASSED
2EVENT 512/01/20209:00:00 PMNOT PASSED
3EVENT 611/01/20208:00:00 PMPASSEDTIMEVALUECURRENT TIMEDATE 11/01/20 01:40AM
Sheet1
Cell Formulas
RangeFormula
D1, D3D1=IF(B1>TODAY()+TIMEVALUE("10:00"),"NOT PASSED","PASSED")
D2D2=IF(B2>TODAY(),"NOT PASSED","PASSED")
 
Upvote 0
Where I am TODAY() is 11/01/2020 so + 10:00 = 11/01/2020 10:00, if B3 is 11/01/2020 with no time then that is 11/01/2020 00:00.
Which is
=IF(11/01/2020 00:00 >11/01/2020 10:00,"NOT PASSED","PASSED") which equates to FALSE therefore "PASSED"
If it was B3+C3> then you would get "NOT PASSED" as in D4 below.

P.S. I don't understand the relevance of the red text in F3 as you aren't using the current time/date or NOW() anywhere.

Book1
ABCD
1EVENT 401/01/20208:00:00 PMPASSED
2EVENT 512/01/20209:00:00 PMNOT PASSED
3EVENT 611/01/20208:00:00 PMPASSED
4NOT PASSED
Sheet5
Cell Formulas
RangeFormula
D1:D3D1=IF(B1>TODAY()+TIMEVALUE("10:00"),"NOT PASSED","PASSED")
D4D4=IF((B3+C3)>TODAY()+TIMEVALUE("10:00"),"NOT PASSED","PASSED")
 
Upvote 0

Forum statistics

Threads
1,215,671
Messages
6,126,133
Members
449,294
Latest member
Jitesh_Sharma

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