Highest 3 consecutive points , ranked

Mantiyeah

New Member
Joined
Sep 19, 2018
Messages
8
I have a column with different location names, and another with their temperatures on different consecutive locations. Each city has a random amount of points/locations (around 40)
For example:
<code>Houston 10
Houston 11
Houston 14
coruna 20
coruna 21
coruna 25
coruna 28
vigo 30
vigo 15
vigo 23
vigo 24
</code>How can I find the hottest 3 consecutive points in a single city and get a link to know where are they positioned? For example ,something to show me that coruna 21, coruna 25, and coruna 28 is the hottest area. Or even coruna 25, coruna 28 and vigo 30, since they are consecutive rows.
We have managed to analyse the hottest cities with pivot tables, but not the worse areas for those cities, which seem like a hardest thing to do.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hello,

With your Pivot Table, you have probably used a Sorting feature ( descending ) ...

Have you tried to Sort in ascending order ?
 
Upvote 0
Hello,

With your Pivot Table, you have probably used a Sorting feature ( descending ) ...

Have you tried to Sort in ascending order ?
Thanks for your answer. The pivot table would give me the total numbers divided by cities, rather than exact points inside the cities. Unless there is some other way to arrange the pivot tables whichs I don't know of.

For example, one city may look like this

houston 12
Houston 13
Houston 43
Houston 12
Houston 12
Houston 12
Houston 34
Houston 33
Houston 40


I would need the excel to point me at the coloured section
 
Upvote 0
Hello,

What would be the rule you want to apply ...???

Is it the highest sum of each group of 3 for the same city ...???
 
Upvote 0
The highest groups of 3 over all of the data, and each group should be part of the same city if possible.
A bigger example:

Houston 1
Houston 1
Houston 2
Houston 2
Houston 2
Houston 3

newyork 1
newyork 1
newyork 2
newyork 3
newyork 3

newyouk 1
paris 5
paris 6
paris 6

paris 5
paris 5
paris 4

So I need something that can do what the colors are doing now
 
Upvote 0
Thanks for your explanation ...

Are you data merged in cells within a single column ...???

In my opinion, a macro would be better than a formula ...

Do you have a preference ...?
 
Upvote 0
I think James is right, this is more suited to a macro. Nevertheless, here's a formula option:


ABCDEF
1CityValueMax Location (row)Sum
2Houston11517
3Houston1108
4Houston257
5Houston2
6Houston2
7Houston3
8newyork1
9newyork1
10newyork2
11newyork3
12newyork3
13newyouk1
14paris5
15paris6
16paris6
17paris5
18paris4

<tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
E2=SUM(INDEX(B:B,D2):INDEX(B:B,D2+2))

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D2{=MOD(MAX(IF(MMULT(COUNTIF($D$1:$D1,ROW($A$2:$A$18)+{-2,-1,0,1,2}),{1;1;1;1;1})=0,IF($A$2:$A$18=$A$4:$A$20,($B$2:$B$18+$B$3:$B$19+$B$4:$B$20)*1000+ROW($B$2:$B$18)))),1000)}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



This works on the small sample you gave, but it has some potential flaws, like if the values in B are non-integer, or if the range isn't sorted.
 
Upvote 0
I think James is right, this is more suited to a macro. Nevertheless, here's a formula option:


ABCDEF
1CityValueMax Location (row)Sum
2Houston11517
3Houston1108
4Houston257
5Houston2
6Houston2
7Houston3
8newyork1
9newyork1
10newyork2
11newyork3
12newyork3
13newyouk1
14paris5
15paris6
16paris6
17paris5
18paris4

<tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
E2=SUM(INDEX(B:B,D2):INDEX(B:B,D2+2))

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D2{=MOD(MAX(IF(MMULT(COUNTIF($D$1:$D1,ROW($A$2:$A$18)+{-2,-1,0,1,2}),{1;1;1;1;1})=0,IF($A$2:$A$18=$A$4:$A$20,($B$2:$B$18+$B$3:$B$19+$B$4:$B$20)*1000+ROW($B$2:$B$18)))),1000)}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



This works on the small sample you gave, but it has some potential flaws, like if the values in B are non-integer, or if the range isn't sorted.
Thank you very much, learning so much by reading the forum.This has been really helpful.
I had no priority of a formula over a macro though.
How would you do it with a macro?
 
Upvote 0

Forum statistics

Threads
1,214,556
Messages
6,120,190
Members
448,949
Latest member
keycalinc

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