Capturing Highest Historical Rank in a Continuously Updated Worksheet

Mz309Lord

New Member
Joined
Feb 12, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have a list of sites that are being ranked based on various factors that feed into the "score" equation, and I also want to be able to capture and save the highest rank each site has ever achieved (and the date of that high ranking).

This is currently captured in an Excel 365 sheet on Sharepoint where various people are able to make updates to factors feeding into the score equation as well as adding new sites to the list. Here's a basic view of the worksheet:

SiteScoreDateRankHighest Historical RankDate of Highest Historical Rank
a901/5/241????
b801/17/242
c701/4/243
d602/1/244
e501/29/245

The "score" is an equation (which updates depending on the whatever the inspector finds on the given date). I have limited VBA skills, so was able to cut and paste someone else's code to get a new field called "previous rank," however, since I want to capture the all time highest rank a site has ever achieved, I'm drawing a blank as to how to maintain that high score. (Here's the tutorial I used to store the previous rank: How to remember or save previous cell value of a changed cell in Excel?)
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hmmmm, assuming your data starts on range A1, maybe you can use this formula in cell E2

VBA Code:
=MAX(FILTER($B$2:$B$6,$A$2:$A$6=A2))

And on cell F2 you can try the following:

VBA Code:
=FILTER(C2:C6,B2:B6=E2)

All based on the data on this screenshot:

1707768784929.png


You would have to update the formula to capture the full range on your sheet. Would it be possible to convert your data into an excel table since the sheet will be updated continuously?
 
Upvote 0
This gives you top 5 and Ties.

Book1
ABCDEF
1SiteScoreDateRankHighest Historical RankDate of Highest Historical Rank
2a802001-05-241902001-04-24
3b802024-01-172822001-11-24
4c702001-04-243802001-05-24
5d602002-01-244802024-01-17
6e502024-01-295782001-02-24
7a902001-04-24782001-10-24
8b712023-12-17
9c672001-03-24
10d652001-12-24
11e662023-12-29
12a752001-03-24
13b722023-11-17
14c692001-02-24
15d822001-11-24
16e652023-11-29
17a782001-02-24
18b732023-10-17
19c662001-01-24
20d782001-10-24
21e742023-10-29
Sheet3
Cell Formulas
RangeFormula
E2:F7E2=SORT(FILTER($B$2:$C$21,B2:B21>=AGGREGATE(14,,$B$2:$B$21,5),""),1,-1)
Dynamic array formulas.
 
Upvote 0
Hmmmm, assuming your data starts on range A1, maybe you can use this formula in cell E2

VBA Code:
=MAX(FILTER($B$2:$B$6,$A$2:$A$6=A2))

And on cell F2 you can try the following:

VBA Code:
=FILTER(C2:C6,B2:B6=E2)

All based on the data on this screenshot:

View attachment 106721

You would have to update the formula to capture the full range on your sheet. Would it be possible to convert your data into an excel table since the sheet will be updated continuously?
Hmmmm, assuming your data starts on range A1, maybe you can use this formula in cell E2

VBA Code:
=MAX(FILTER($B$2:$B$6,$A$2:$A$6=A2))

And on cell F2 you can try the following:

VBA Code:
=FILTER(C2:C6,B2:B6=E2)

All based on the data on this screenshot:

View attachment 106721

You would have to update the formula to capture the full range on your sheet. Would it be possible to convert your data into an excel table since the sheet will be updated continuously?
Hmmmm, assuming your data starts on range A1, maybe you can use this formula in cell E2

VBA Code:
=MAX(FILTER($B$2:$B$6,$A$2:$A$6=A2))

And on cell F2 you can try the following:

VBA Code:
=FILTER(C2:C6,B2:B6=E2)

All based on the data on this screenshot:

View attachment 106721

You would have to update the formula to capture the full range on your sheet. Would it be possible to convert your data into an excel table since the sheet will be updated continuously?
I tried plugging that formula into E1 (not as VBA code, just regular excel) and as soon as the score in B1 is overwritten, E1 shows the latest score. I see that you're suggesting I plug the formula in as VBA code, though, so I'm probably doing this incorrectly. How do I plug VBA code into specific cells as you suggest? (I'm only familiar with inserting code into whole tabs, as I'm a VBA newbie.)
 
Upvote 0
This gives you top 5 and Ties.

Book1
ABCDEF
1SiteScoreDateRankHighest Historical RankDate of Highest Historical Rank
2a802001-05-241902001-04-24
3b802024-01-172822001-11-24
4c702001-04-243802001-05-24
5d602002-01-244802024-01-17
6e502024-01-295782001-02-24
7a902001-04-24782001-10-24
8b712023-12-17
9c672001-03-24
10d652001-12-24
11e662023-12-29
12a752001-03-24
13b722023-11-17
14c692001-02-24
15d822001-11-24
16e652023-11-29
17a782001-02-24
18b732023-10-17
19c662001-01-24
20d782001-10-24
21e742023-10-29
Sheet3
Cell Formulas
RangeFormula
E2:F7E2=SORT(FILTER($B$2:$C$21,B2:B21>=AGGREGATE(14,,$B$2:$B$21,5),""),1,-1)
Dynamic array formulas.
OK, thank you, however, I don't need to see top 5 or ties. Also, the list doesn't grow as you've shown (updated site info doesn't get concatenated to the end of the list--instead, the score and date of inspection are simply overwritten in columns B and C, and then the Rank formula i have in column D automatically updates itself to show the newest rank.)
 
Upvote 0
@Coyotex3 when posting a formula please use the formula tags (the xls icon), it avoids confusion over whether you are posting a formula or VBA.
 
Upvote 0
@Coyotex3 when posting a formula please use the formula tags (the xls icon), it avoids confusion over whether you are posting a formula or VBA.
Sure thing. Can't believe I didn't notice there was a different tag for Formulas until now! Will make the change moving forward.
 
Upvote 0
I tried plugging that formula into E1 (not as VBA code, just regular excel) and as soon as the score in B1 is overwritten, E1 shows the latest score. I see that you're suggesting I plug the formula in as VBA code, though, so I'm probably doing this incorrectly. How do I plug VBA code into specific cells as you suggest? (I'm only familiar with inserting code into whole tabs, as I'm a VBA newbie.)
Apologies, as Fluff pointed out, I used the VBA code Tags as opposed to the Formula code tags. This is a formula, no need to use VBA on this one.

What do you mean when the score is overwritten? Based on my example, if you write say 97 on cell B2(B1 contains the titles, Cell B2 contains the data), then E2 should show 97. Is that not happening on your end?
 
Upvote 0
@Coyotex3 I did try inserting your formulas (and would be thrilled to get formulas to do this job rather than VBA!), however, when I overwrite B2 with any new number, then E2 just shows me that newest B2 entry. So for example, if at first Site A scores 90, then the next day they score 93, I can see that E2 goes up to 93 and I get the newest date in F2, but then on the third day if the score drops to 53, then E2 and F2 don't save that old high score of 93 with correlating date of yesterday...
 
Upvote 0
Here is what I'm considering might work, but I'm not quite sure how to code it:
Apologies, as Fluff pointed out, I used the VBA code Tags as opposed to the Formula code tags. This is a formula, no need to use VBA on this one.

What do you mean when the score is overwritten? Based on my example, if you write say 97 on cell B2(B1 contains the titles, Cell B2 contains the data), then E2 should show 97. Is that not happening on your end?
Hi @Coyotex3 --I just realized why your code doesn't work: it's because you have added an additional row for Site A with a new date, so the code works if I keep adding new rows for the existing sites. However, that's not how this dataset gets updated. (We might add new sites H, I, J, K, etc. etc.), but when the sites we already inspect get a new score, their old score is over-written. So when site A started out with a score of 90, the next day that 90 appearing in cell B2 is overwritten with 93--which should now be captured as the new high score. When the site is inspected three days later and gets a score of 53, I still want the all-time-high score for site A to show 93. Does that make sense?
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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