Excel - Date/time subtraction

February 2017



Issue


Ineed a macro that will subtract date-time in column A with the Present Date-time and display the value as number of days..

(Sample Calculation performed at 6/1/2012 21:00)
-------A----------------------------B------------------------

6/1/2012 21:44-----------------0
6/2/2012 12:42-----------------1
6/3/2012 08:44-----------------1
6/5/2012 20:44-----------------2
2/1/2012 22:32-----------------126
5/3/2012 11:11-----------------35


Values in column A can vary so calculation is done according to it..

Solution


Suppose that the data is A1 to B6

In C1 type this formula
=NOW()-A1 

In D1 type this formula
=DAY(C1) 

Highlight c1 and d1 and copy them down



Thanks to RWomanizerfor this tip.

Related


Published by aakai1056. Latest update on June 13, 2012 at 10:52 AM by aakai1056.
This document, titled "Excel - Date/time subtraction," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).