Find Max of Year

Pestomania

Active Member
Joined
May 30, 2018
Messages
332
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to find the "max" per year. I have this formula, but it returns value of 1 even when the max is 0 and doesn't define the year appropriately. This formula works when it is "sumproduct" but not when it is max.. It does return the appropriate number whenever there is a value greater than 0 in the selection.

Excel Formula:
=MAX($G$15:$AP$15,--(YEAR($G$14:$AP$14)=G$10))

10 Year Capacity Planning Model Rev 20240321 - Full_Morin_Densification.xlsm
FGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAP
10202320242025
11Max393939
12Sum123788
13
141/1/20232/1/20233/1/20234/1/20235/1/20236/1/20237/1/20238/1/20239/1/202310/1/202311/1/202312/1/20231/1/20242/1/20243/1/20244/1/20245/1/20246/1/20247/1/20248/1/20249/1/202410/1/202411/1/202412/1/20241/1/20252/1/20253/1/20254/1/20255/1/20256/1/20257/1/20258/1/20259/1/202510/1/202511/1/202512/1/2025
15200100000000040060000012150003901403500000
Proposed Equipment Add
Cell Formulas
RangeFormula
G11:I11G11=MAX($G$15:$AP$15,--(YEAR($G$14:$AP$14)=G$10))
G12:I12G12=SUMPRODUCT($G$15:$AP$15,--(YEAR($G$14:$AP$14)=G$10))
 
Not sure why you are using a table when you have what looks like a load of blank rows in there, as that defeats the main reason for a table.
try
Excel Formula:
=MAX(FILTER(INDIRECT("Morin_"&$A5&"_Equipment_Proposed"),YEAR(Capacity_Charts_Date_Range)=C$1+0))-SUM($B5:B5)
 
Upvote 0
Solution

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Not sure why you are using a table when you have what looks like a load of blank rows in there, as that defeats the main reason for a table.
try
Excel Formula:
=MAX(FILTER(INDIRECT("Morin_"&$A5&"_Equipment_Proposed"),YEAR(Capacity_Charts_Date_Range)=C$1+0))-SUM($B5:B5)
That worked both in and out of the table. I am slowly adding all of those references as named ranges for the remainder of the tables.
 
Upvote 0
How would that be if it works whenever it is outside of a table?

It provides results whenever not in a table:
View attachment 109003

But as soon as I turn that range into a table, it stops working. I can work with it and just work on different methods, but tables look nice.
Just a guess, but ... turning the range into a table you use the years as a header row. Before the table they are numbers, but the table headers are text strings, so you get no match comparing numbers with strings.
so try this:
Excel Formula:
=MAX(FILTER(INDIRECT("Morin_"&$A5&"_Equipment_Proposed"),YEAR(Capacity_Charts_Date_Range)=VALUE(C$1)))-SUM($B5:B5)
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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