Day per month between 2 dates

Dcata

New Member
Joined
Apr 10, 2018
Messages
7
Hi everyone,

I was wondering if you could help.

Is there a formula I can put in cells D3-G4 that looks at the start and end dates in columns A & B, counts the number of days that used in the month (E2-G2) and then multiplies the number of days by the cost in column C?

If it helps, the value in D2 is currently 31/01/2020 but Formatted to "Mmm"

Thanks a lot

ABCDEFG
1Spend per monthSpend per monthSpend per monthSpend per month
2StartEndCost per DayJanFebMarApr
320/01/202004/02/20201516560
427/02/202007/04/20202040620140
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
11,981
Office Version
  1. 365
Platform
  1. Windows
It is more common to use the first day of the month formatted as mmm than the last day, but either can be made to work.
25.08.20.xlsm
ABCDEFG
1Spend per monthSpend per monthSpend per monthSpend per month
2StartEndCost per DayJanFebMarApr
320/01/202004/02/2020151656000
427/02/202007/04/202020040620140
Sheet22
Cell Formulas
RangeFormula
D3:G4D3=(MEDIAN(EOMONTH(D$2,0),$A3,$B3)-MEDIAN(EOMONTH(D$2,-1),$A3,$B3))*$C3
 

mse330

Well-known Member
Joined
Oct 18, 2007
Messages
711
Office Version
  1. 365
Platform
  1. Windows
@jasonb75 excellent utilization of the median function, I have encountered similar case before & had a much, much longer formula to get the same results. Thank you, I have learned something new today :)
 

Watch MrExcel Video

Forum statistics

Threads
1,123,337
Messages
5,601,026
Members
414,422
Latest member
acegreen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top