Extracting the current date from the computer and comparing to a date in an excel spreadsheet

Patricia Timm
Patricia Timm used Ask the Experts™
Is there a way to check the current date (on the computer - maybe system date - so it grabs the current date) and then compares to a date on an excel spreadsheet like a parts ordered date in the format 11/20/2019. Not sure if I can use excel formulas or if vb code would need to be used??? thanks in advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018
There may be a formula but this VBA  does something if the cell value is equal to or greater than 40 days prior to today
 
   If  DateDiff("d", wsRenew.Cells(lngRow, "B"), Now) >= 40 Then

Open in new window

Test your restores, not your backups...
Top Expert 2016
You can do it with a formula.  NOW() always returns the current date and time.  To compare just the date to a cell with a date in it, you can do something like:

=IF(INT(NOW())=A1,"Y","N")

The INT() will pull out just the date from the date/time that NOW() returns.


»bp
thanks!!
Bill PrewTest your restores, not your backups...
Top Expert 2016
Welcome, glad that helped.


»bp
Or TODAY function gives just the current date:

=TODAY()

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial