In Apple Numbers, how can I calculate a difference between two dates?

MedicineMan picture MedicineMan · Sep 28, 2011 · Viewed 10.5k times · Source

I have a spreadsheet with data in Apple Numbers. I have a column of dates, and I would like to create a second column which displays the difference in number of days between the two dates.

Example:

Date..................Difference

May 1, 2011......NA

May 3, 2011......2

May 8, 2011......5

My first inclination is applescript, but perhaps applescript might be overkill for this task.

In any case, please fwd as needed.

Answer

Philip Regan picture Philip Regan · Sep 28, 2011

Applescript and Automator is definitely overkill. All you need to do given two dates is reference the cells in an equation and Pages handles the rest. So, given...

    'A'                 'B'
'1' '2011 September 28' ''
'2' '2011 September 27' ''
'3' '2011 September 20' ''

...you only need to do then...

    'A'                 'B'
'1' '2011 September 28' ''
'2' '2011 September 27' '=A2-A1' --> gives "1d"
'3' '2011 September 20' '=A3-A1' --> gives "8d"