Forum Discussion

CamilleER's avatar
CamilleER
Copper Contributor
Dec 09, 2022

Number of days in a month - between two dates

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

  • Vinit0412's avatar
    Vinit0412
    Copper Contributor

    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.

     

     

  • mathetes's avatar
    mathetes
    Silver Contributor

    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.

Resources