MAX number of a cell if cell is in specific date range

paun_shotts

New Member
Joined
Nov 4, 2021
Messages
38
Office Version
  1. 2013
Platform
  1. Windows
Hi,

Firstly, MAXIFS would work, but I don't have Office 360, I'm running Office 2013.
I need to find out the MAX number of column L if the date in column G is >= 2021,7,1 and <= 2022,6,30 (Financial year)
I am currently just using the MAX function, but It required me to update the range at the end of the financial year "=MAX('Supplier Evaluation Log'!L67:L128)" I dont want to have to remember to update this.
I have used AVERAGEIFS and SUMIFS and COUNTIFS for my other needs as per below:
=IFERROR(AVERAGEIFS('Supplier Evaluation Log'!J:J,'Supplier Evaluation Log'!G:G,">="&DATE(2021,7,1),'Supplier Evaluation Log'!G:G,"<="&DATE(2022,6,30)),"0")

I have read that this can be done with =AGGREGATE as well as an array of =MAX(IF(TEXT... but I am not able to get this to work.
Can someone please help me out?

I need to find out the MAX number of column L
If the date in column G is >= 2021,7,1 and <= 2022,6,30 (Financial year)
 

Attachments

  • Capture.JPG
    Capture.JPG
    136.4 KB · Views: 12
  • Capture1.JPG
    Capture1.JPG
    27.5 KB · Views: 13

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
See if the following array formula (to be entered using Ctrl+Shift+Enter, not just Enter) works for you:
Excel Formula:
=MAX(IF((G2:G32>=DATE(2021,7,1))*(G2:G32<DATE(2022,7,1)),L2:L32))
 
Upvote 0
.. or using AGGREGATE as mentioned.
(I would recommend against using whole column references like you have in at least one formula above)

21 11 05.xlsm
GHIJKLMN
1
211/09/20202686
322/09/202014
41/11/20206
510/12/202076
625/12/202015
713/03/202152
824/04/20217
930/08/202135
1012/01/20221
1117/01/202286
1227/04/202260
131/05/202247
146/06/202275
152/07/202230
1624/08/202290
172/09/202222
1830/09/202279
1914/11/202217
2021/12/202278
2131/12/20225
MAX IF
Cell Formulas
RangeFormula
N2N2=AGGREGATE(14,6,L$2:L$2000/((G$2:G$2000>=DATE(2021,7,1))*(G$2:G$2000<=DATE(2022,6,30))),1)
 
Upvote 0
Solution
You're welcome. Glad we could help. Thanks for the follow-up. :)
 
Upvote 0
Whats your reasoning for "(I would recommend against using whole column references like you have in at least one formula above)"
When you specify a whole column reference, many functions will process all 1,048,576 cells for each column reference. That puts a significant burden on your machines calculation resources and can slow your sheet's performance noticeably.

As examples,
I put my formula (which checks 1,999 rows) in 20 cells and then my same formula but with whole column references and timed the recalculation of each group of 20 cells.
The 20 with full column references took 2.0015 seconds to re-calculate.
The 20 with the restricted rows took 0.00985 seconds to recalculate.

I then put Tetra201's MAX(IF formula (but changed it to also calculate over 1,999 rows) in 20 cells and the same formula with whole column references
The 20 with full column references took 1.9488 seconds to re-calculate.
The 20 with the restricted rows took 0.0092 seconds to recalculate.

So, on that size range with those formulas, the whole column reference formulas take more than 200 times the calculation time of the restricted ones.
 
Upvote 0
I, in turn, would recommend against using the "<=" when working with dates, and here is why:

It is not uncommon that dates are entered as date-and-time (especially when the data come from outside automated sources) but formatted as date-only. In your case, if there is a datapoint where date is entered as, say, "30/06/2022 11:11", a formula with a "<=DATE(2022,6,30)" will miss it because "DATE(2022,6,30)" evaluates to "30/06/2022 0:00". That’s why I used a "<DATE(2022,7,1)" in my formula in Post #2.
 
Upvote 0

Forum statistics

Threads
1,214,797
Messages
6,121,629
Members
449,041
Latest member
Postman24

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