Changing an array formula to a LET

Marvo

Board Regular
Joined
Nov 27, 2023
Messages
182
Office Version
  1. 2021
Platform
  1. Windows
Hi All, having just upgraded to excel 2019 to excel 2021, I now have use of the improved formula tools. I have recently changed all the array formula in the grid looking for Consecutives results by using the LET function.

For example I replace this array

=MAX(FREQUENCY(IF((ALL!$J$2:ALL!$J$6000="W")*(ALL!$I$2:ALL!$I$6000="League")*(ALL!$E$2:ALL!$E$6000="H"),ROW(ALL!$J$2:ALL!$J$6000)),IF((ALL!$J$2:ALL!$J$6000<>"W")*(ALL!$I$2:ALL!$I$6000="League")*(ALL!$E$2:ALL!$E$6000="H"),ROW(ALL!$J$2:ALL!$J$6000))))

with this

=LET(t,FILTER(ALL!$K$2:$K$9999,(ALL!$J$2:$J$9999="League")*(ALL!$E$2:$E$9999="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="W",s),IF(t<>"W",s))))

I've now moved on to the Longest Runs but can't fathom how to get a start.

For example, in cell C16, the question being addressed is what is the longest run of games the team has gone without a defeat, with the criteria being games played at home and in the League (Not cup).

This array formula works fine

=MAX(FREQUENCY(IF((ALL!$K$2:$K$6000<>"L")*(ALL!$K$2:$K$6000<>"")*(ALL!$J$2:$J$6000="League")*(ALL!$E$2:$E$6000="H"),ROW(ALL!$K$2:$K$6000)),IF((ALL!$K$2:$K$6000="L")*(ALL!$J$2:$J$6000="League")*(ALL!$E$2:$E$6000="H"),ROW(ALL!$K$2:$K$6000))))

but I would very much like to take advantage of the simpler (and shorter) LET function if possible.

If anybody could point me in the right direction I'd be most grateful.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
how about:
Excel Formula:
=LET(ColumnK,ALL!$K$2:$K$6000,ColumnJ,ALL!$J$2:$J$6000,ColumnE,ALL!$E$2:$E$6000,MAX(FREQUENCY(IF((ColumnK<>"L")*(ColumnK<>"")*(ColumnJ="League")*(ColumnE="H"),ROW(ColumnK)),IF((ColumnK="L")*(ColumnJ="League")*(ColumnE="H"),ROW(ColumnK)))))
 
Upvote 0
How about
Excel Formula:
=LET(t,FILTER(ALL!$K$2:$K$9999,(ALL!$K$2:$K$9999<>"")*(ALL!$J$2:$J$9999="League")*(ALL!$E$2:$E$9999="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"L",s),IF(t="L",s))))
 
Upvote 0
Solution
That produces the correct answer. Hopefully I'll be able to adapt it to the other boxes. Thank you so much.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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