# Calculating days in a month from a date

Options
✭✭✭✭✭

I need to calculate the days in a month from a date.

I have 2 columns:

• Check-In Date
• Check-Out Date

What I want to do is the following:

• Create 2 columns:
• Days in Current Month
• Days in Next Month
• On the 2nd entry, I want to count the days in July. So the returned value would be 1.
• Ignore the 3rd entry since all of the days fall in July.
• Then count the August day in the 4th entry for a value of 6.

• ✭✭✭✭✭✭
Options

First month:

=(IFERROR(DATE(YEAR([Check-In Date]@row), MONTH([Check-In Date]@row) + 1, 1), DATE(YEAR([Check-In Date]@row) + 1, 1, 1)) - 1) - [Check-In Date]@row

Second Month:

=DAY([Check-Out Date]@row

• ✭✭✭✭✭✭
Options

First month:

=(IFERROR(DATE(YEAR([Check-In Date]@row), MONTH([Check-In Date]@row) + 1, 1), DATE(YEAR([Check-In Date]@row) + 1, 1, 1)) - 1) - [Check-In Date]@row

Second Month:

=DAY([Check-Out Date]@row

• ✭✭✭✭✭
Options

It works perfectly. Thank you for the help!

• ✭✭✭✭✭
Options
• ✭✭✭✭✭✭
Options

Happy to help. 👍️

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!