excel days counting formula

K

krc547

what if I need to count number of days except if cell d17 is not the end of
the month. Example C17 and D17 are as follows:
c17=11/25/07 d17=11/29/07 instead of it returning 5 days I would need it
to return 4 days because the client was not here until the end of the month.
But I currently have this in my cell: =IF(C17="","0",DATEDIF(C17,D17,"D")+1)
 
B

Bernard Liengme

How about:
=(D17-C17)+(DATE(YEAR(D17),MONTH(D17)+1,0)=D17)

The first term computes the number of days - there is no need for DATEDIFF
This give 4 in the case or 25 Nov to 29 Nov and 5 in the case or 25 Nov to
30 Nov.

The second then checks is the D17 date is the end of the months and, if so,
adds 1

best wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top