populating a column automatically

K

Kevin

I have dates in two columns, and I want the third column to list the
number of days between the two dates in a row. There must be a way to
do this without putting a formular in every cell in the third column,
isn't there?
 
D

Don Guillett

You could use a macro to do this
for each c in range("a2:a200")
c.offset(,2)=c-c.offset(,1)

next
 
K

Kevin

Don said:
You could use a macro to do this
for each c in range("a2:a200")
c.offset(,2)=c-c.offset(,1)

next

Sorry--I don't quite get it. EARLYDATE is C3:C21
LATEDATE is D3:D21

I want column E to be LATEDATE-EARLYDATE, basically (D3:D21)-(C3:C21)
 
E

Earl Kiosterud

Kevin,

What's wrong with a formula in each cell? It's the way stuff is done with
Excel. You'd type in the first, then copy it down as far as needed with the
Fill Handle, or Copy - Paste:

=B2-A2

Or if the dates have times also, then

=INT(B2) - INT(A2)

For inclusive:

=B2-A2 + 1

Format (Format - Cells - Number) for any non-date format.
 
D

Don Guillett

just modify to suit.

for each c in range("d3:d21")
c.offset(,1)=c-c.offset(,-1)
next
 
Top