Logic check - trouble with Index Max

plant007

Board Regular
Joined
Jun 2, 2011
Messages
55
Office Version
  1. 2019
Platform
  1. Windows
Hi

I am really hoping you can help!

I am trying to compare a 'work start date' (first column - see yellow - Q3 2025/26) against the the field name (YYYY) of the last spend entry in an annual profile, in the case below its '2024/25'. This is to show whether the 'work start date' is before or after the last annual profile spend entry. Basically its a logic check as 'start of works' should not be after the last annual profile spend entry. As 2025 is after 2024, I would show an error message

The big array equation starts thus to handle blanks etc, and the first and last spend as they are aggregated and therefore need a manual check -
=IF(OR(B13=1,'3. Planned Investment'!Z7="",'3. Planned Investment'!AA7=""),"Either, or both, Work Start Date and Date in Service are incomplete",IF(INDEX('3. Planned Investment'!$2:$2,MAX(IF('3. Planned Investment'!AD7:AP7<>0,COLUMN('3. Planned Investment'!AD7:AP7))))="Prior Years' Spend (£m)",CONCATENATE("As last profile is Prior Years' Spend, CHECK against ", TEXT('3. Planned Investment'!Z7,"DD/MM/YYYY")),IF(INDEX('3. Planned Investment'!$2:$2,MAX(IF('3. Planned Investment'!AD7:AP7<>0,COLUMN('3. Planned Investment'!AD7:AP7))))="Remaining spend beyond last known year (£m)",CONCATENATE("As last profile is Remaining spend beyond last known year (£m), CHECK against ", TEXT('3. Planned Investment'!Z7,"DD/MM/YYYY")))))

  1. The last part I need to add to the above equation compares 2 parts - =MID('3. Planned Investment'!Z7,4,4) which gives me 2025 which is correct
  2. The other part (which I will wrap a Mid around) where the answer should be 2024 gives me #REF! - =INDEX('3. Planned Investment'!$AD$2:$AP$2,MAX(IF('3. Planned Investment'!AD7:AP7<>0,COLUMN('3. Planned Investment'!AD7:AP7))))
  3. Ill then add on a concatenated message, to the effect that there is an error as the work starts after the spend has finished

Any help on #2 most appreciated!!
Cheers
Andy



1683838165423-png.91468
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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