No correct calculation with Nested IF + AND Function

LearningByDoing

New Member
Joined
Aug 17, 2023
Messages
11
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hello,
I have the data ranges shown in the screenshot (columns A-E) and I am trying to use the IF function to fill in the time series (columns G-N) from them. It actually works except for the fact that the first month is not calculated in each case.

To understand better:
B9 has the value 1,000,000 - E9 has the value 3 - C9 is the start month and D9 is the end date.
The IF function should distribute one third of the start month to the end date each month.
Where is my mistake in the formula that the first month is not calculated?
Thank you in advance for your support.

cost_baseline_expenditure_schedule_-_template_EUR.xlsx
ABCDEFGHIJ
6DURATA IN MESE7TOTALI MENSILI €333,333.33€608,333.33€225,445.00
7PROGETTO COSTI TOTALE2,065,890.00 €
8CategoriaCOSTI TOTALEINIZIOFINEDURATAgen-2024feb-2024mar-2024apr-2024
9CAT_01€1,000,000.00Jan-24Mar-243 €333,333.33€333,333.33 
10CAT_02€250,000.00Feb-24Mar-242  €125,000.00 
11CAT_03€150,000.00Feb-24Apr-242  €75,000.00€75,000.00
12CAT_04€75,000.00Mar-24Apr-242   €37,500.00
AUTO_PROSPETTO_COSTI
Cell Formulas
RangeFormula
G6:J6G6=IF(SUM(G9:G200)=0,"",SUM(G9:G200))
B6B6=SETUP_BASELINE!F5
B7B7=COSTESTIMATE
G8G8=STARTDATE
H8:J8H8=IF(G8<ENDDATE,EDATE(G8,1),"")
G9:J12G9=IF(G$8="","",IF(AND(G$8>=$C9,G$8<=$D9),($B9/$E9),""))
A9:E12A9=IF(SETUP_BASELINE!B9="","",SETUP_BASELINE!B9:F9)
Dynamic array formulas.
Named Ranges
NameRefers ToCells
COSTESTIMATE=SETUP_BASELINE!$C$5B7
ENDDATE=AUTO_PROSPETTO_COSTI!$B$5H8:J8
STARTDATE=AUTO_PROSPETTO_COSTI!$B$4G8
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E9:E201Celldoes not contain a blank value textNO
G6:BB6,H7:BB7Celldoes not contain a blank value textNO
G8:H8,K8:BB8Celldoes not contain a blank value textNO
I8:J8Celldoes not contain a blank value textNO
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
... with a little trial and error, I found out what the problem was. The dates in columns C and D are taken from another sheet using the IF function in cell A9. If the date is not entered exactly on the first of the month, the problem described above occurs. Why this is the case is beyond my knowledge. Does anyone have any ideas?
 
Upvote 0
If you are not going to allocate down to partial months, give this a try:
Excel Formula:
=IF(G$8="","",IF(AND(G$8>=EOMONTH($C9,-1)+1,G$8<=$D9),($B9/$E9),""))
 
Upvote 0
Solution
... @Alex Blakenburg
Thank you very much, that's the solution.
I had toyed with EOMONTH too, but wanted to take a closer look at the other date functions first. Now that's been taken care of.
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,224
Members
453,025
Latest member
Hannah_Pham93

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
Back
Top