Looking for a better and worse sequence

Marvo

Board Regular
Joined
Nov 27, 2023
Messages
172
Office Version
  1. 2021
Platform
  1. Windows
Hi All, I have a large workbook that involves all the matches of Northampton Town FC. On the worksheet I have a cell (W1) that you can put however many matches you like and you can see how many points have been gained from those most recent matches (current form). This works fine.
In W5 I have for League matches only
=SUMPRODUCT(COUNTIFS(INDEX(ALL!K:K,LARGE(INDEX(ROW(ALL!$K:$K)*(ALL!$K:$K<>"")*(ALL!$J:$J=$V$5),),$W$1)):ALL!$K$9999,{"W","D"},INDEX(ALL!J:J,LARGE(INDEX(ROW(ALL!$K:$K)*(ALL!$K:$K<>"")*(ALL!$J:$J=$V$5),),$W$1)):ALL!$J$9999,$V$5),{3,1})
In W7 I have for all matches
=SUMPRODUCT(COUNTIFS(INDEX(ALL!K:K,LARGE(INDEX(ROW(ALL!$K:$K)*(ALL!$K:$K<>""),),$W$1)):ALL!$K$9999,{"W","D"},INDEX(ALL!J:J,LARGE(INDEX(ROW(ALL!$K:$K)*(ALL!$K:$K<>""),),$W$1)):ALL!$J$9999,$V$5),{3,1})

Now somebody several years ago placed VBA on the worksheet that would look back to find the last time the most recent sequence was either better or worse (and other things). This was very useful but sadly it went awry and I don't don't understand VBA and now its disappeared altogether. So what I'm wondering is whether I could put a formula in a cell to do the same job?

So just to reiterate, if the club in its last 5 games had just won its last 4 league games and drawn another = 13pts, the formula would look for the previous sequence of 5 games when that was bettered (that could only be 5 wins).
Alternatively if the club was in a slump and in its last 5 games it had lost 4 and drawn 1 = 1pt, it would look for the last time the club did worse than that which would have to be 5 sequential defeats = 0pts.

Now all this makes sense to me when I read it back but I'm guessing it wont make any sense to anyone else. My question is, it it possible to do this with a formula?

example.JPG
 
It's quite difficult isn't it. The original formula

=SUMPRODUCT(COUNTIFS(INDEX(ALL!K:K,LARGE(INDEX(ROW(ALL!$K:$K)*(ALL!$K:$K<>"")*(ALL!$J:$J=$V$5),),$W$1)):ALL!$K$9999,{"W","D"},INDEX(ALL!J:J,LARGE(INDEX(ROW(ALL!$K:$K)*(ALL!$K:$K<>"")*(ALL!$J:$J=$V$5),),$W$1)):ALL!$J$9999,$V$5),{3,1})

looks up from the last result (I don't know why it does that) however many games you tell it to. Then you're looking for the most recent time that you had a better or worse sequence for that amount of games which if you did manually through 5,500 rows would be painstaking. I wouldn't know where to start. The guy who put the VBA on it (since removed) managed it but how you'd do it with formula I'm at a loss and I'm guessing it would take a huge resource. I may have an old workbook in my refuse bin with the old VBA but again I wouldn't know how to install it into this workbook and I wouldn't know how it worked anyway.
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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