Link to home
Start Free TrialLog in
Avatar of GordonMasson
GordonMasson

asked on

Calculation in VBA of difference between TODAY and a date in another cell.

I have a cell with a date in it and I want to get a value that equates to the number of days from todays date.
So if the date is 5 days ago the it should return a number of -5, similarly todays date should return 0 and tomorrows date should return 1
Thanks
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Hello,

with the date in A1, try

=A1-TODAY()

Make sure to format the result as General, not date!!

cheers, teylyn
ASKER CERTIFIED SOLUTION
Avatar of jppinto
jppinto
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Basically in VBA, just:
Range("A1").value - Date

Open in new window

Avatar of GordonMasson
GordonMasson

ASKER

That works for me ...Thanks