I have found the solution thought it would be good to share:

so the formula should be : =((MAX(CT\$6-\$N8,0)-MAX(EOMONTH(CT\$6,-1)-\$N8,0))-(MAX(CT\$6-\$O8,0)-MAX(EOMONTH(CT\$6,-1)-\$O8,0))+(EOMONTH(CT\$6,0)=EOMONTH(\$N8,0)))*1

:)

I am trying to write an excel formula which can be dragged across a row of cells to give the number of days in each month between two specified dates. E.g:

I tried using a if with sum product formula from the same website but for some reason it is not recognising the days of last month. was wondering if someone could help explain what this formula does and how to correct it.

=IFERROR(IF(AND(CS\$6>=\$M9,CS\$6<=\$N9),SUMPRODUCT(--(MONTH(ROW(INDIRECT(\$M9&":"&IF(\$N9="",TODAY(),\$N9))))=MONTH(CS\$6))),),"")

Apr 6, 2022 in Database 2,142 views

## 1 answer to this question.

Anyway, here's an alternative completeness approach based on the conventional formula.

`=max(0,min(end1,end2)-max(start1,start2)+1)`

for the overlap of two date ranges, which results in

`=MAX(0,MIN(IF(\$B2="",TODAY(),\$B2),EOMONTH(DATEVALUE(C\$1&"-17"),0))-MAX(\$A2,DATEVALUE(C\$1&"-17"))+1)`

• 23,260 points

## How to sort dates from Oldest to Newest in Excel?

Drag down the column to select the ...READ MORE

## Merging Two excel files as two sheets in one workbook in java

I have two xlsx files at folder ...READ MORE

## How to count distinct values in Excel

Use functions to count the number of ...READ MORE

## Count unique values in a column in Excel

Excel may be used to count unique ...READ MORE

## Excel formula to remove space between words in a cell

There are three fast techniques to get ...READ MORE

## How do I merge two rows in Excel?

Hi I'm not even sure if this ...READ MORE

## How do I split a cell in Excel into two or more where they are divided horizontally?

Table cells should be combined. To make a ...READ MORE

## How do I merge two rows in Excel?

Hi I'm not even sure if this ...READ MORE