Help!!!

SEATOWN

New Member
Joined
Jun 29, 2011
Messages
6
OK, So it has been like 9 years since I have used excel... I was able to get most of my project for work completed but am now stuck and need some help.
I have collumn with 9 numbers that get re-entered daily... for example

10
15
10
45
80
0
10
5
40

I want to have the seven of these that are both consecutive within the collumn and have the highest SUM to be highlited. I have tried all kinds of conditional formatting but cant get it to work. Thank you in advance.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
What exactly do you mean when you say consecutive?

with the data you provided, can you provide the end result you desire?
Start:
10
15
10
45
80
0
10
5
40

End:
?
 
Upvote 0
with the data i provided there are three possible consecutive 7 number groups: cells A1:A7 A2:A8 A3:A9

10
15
10
45
80
0
10
which totals 170

15
10
45
80
0
10
5
which totals 165

10
45
80
0
10
5
40
which totals 190

So I would want the third set of seven cells to be highlighted red
 
Upvote 0
I feel like this should be fairly simple, but I am having issues getting it to work properly... Any help would be appreciated!
 
Upvote 0
In the adjacent column from the seventh row have =Sum(B1:B7) and copy down then haveconditional formatting based on =Max(B:B)
 
Upvote 0
Thanks for your reply, I really appreciate it... I am still a bit confused though on what you mean exactly. SO I have what looks like this:

...A
1 10
2 15
3 10
4 45
5 80
6 0
7 10
8 5
9 40

I also have numbers entered in the B collumn and C Collumn and want the same conditional formatting for those collumns as well... thank you in advance...
 
Upvote 0
use this macro then (place it in ThisWorkbook):

Code:
Sub highlightsum()
Range("A1:A9").Interior.ColorIndex = xlNone

Cells(10000, 30).Formula = "=MAX(SUM($A$1:$A$7),SUM($A$2:$A$8),SUM($A$3:$A$9))"
Cells(10000, 31).Formula = "=SUM($A$1:$A$7)"
Cells(10000, 32).Formula = "=SUM($A$2:$A$8)"
Cells(10000, 33).Formula = "=SUM($A$3:$A$9)"

If Cells(10000, 31).Value = Cells(10000, 30).Value Then
    Range("A1:A7").Interior.ColorIndex = 6

ElseIf Cells(10000, 32).Value = Cells(10000, 30).Value Then
    Range("A2:A8").Interior.ColorIndex = 6

ElseIf Cells(10000, 33).Value = Cells(10000, 30).Value Then
    Range("A3:A9").Interior.ColorIndex = 6
End If
End Sub
Uses helper cells DD10000-GG10000 (so hopefully you have no data there already)

Ill try to consolidate this to not use any helper cells if i can figure it out.

You mentioned something about highlighting other columns of data--did you want an entire row highlighted based on the criteria for the data in A instead of just a cell?

In your example, Rows 3-9 to be highlighted instead of only Cells A3:A9?
 
Last edited:
Upvote 0
I just edited the above macro so that you can re-use this macro; if you make changes to the data you can re-run it to see which 7 numbers make the highest sum.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,245
Members
452,900
Latest member
LisaGo

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