Number of days in a month - between two dates

Copper Contributor

Hi !

I need some help to easily calculate a number of days in a particular way.

For example: 

I have a period, let's say from 17/11/2022 to 18/12/2022.

I would like to know how many days there is only in november. (result 14 days, because "day 17" is included).

Do you know a way or formula which can calculate that ? 

Thanks for your support, 

CamilleER

2 Replies

@CamilleER 

 

I have no doubt that there's a more elegant way to do it, but here's a formula that will work for any given date, telling you how many days are left in the month of that given date.

 

So enter the date 11/17/22 in cell A1

and in some other cell enter this formula

=DATE(YEAR(A1),MONTH(A1)+1,1)-A1

 

If you're curious, this finds the first day of the next month--in this case 12/1/22--and subtracts the date in A1 from that date, to yield 14.

@CamilleER 

Hi,

suppose we enter the date 17/11/2022 in cell A2. Enter below formula in cell B2.
=DAYS(EOMONTH(A2,0),A2)+1

 

Make sure you set the format of cell B2 as Number with 0 decimal places.

 

Vinit0412_1-1670682725099.png