Visual trend indicators

paulkc

Board Regular
Joined
May 18, 2007
Messages
204
Office Version
  1. 365
I want to format cells base on a continued trend up or down. For example, if cells a2:g2 contain values that decrease each successive cell gets a stronger red. On the other hand, if they are increasing, they would get formatted in stronger greens. Is this even remotely possible?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Schermafbeelding 2022-05-05 084257.png
Map1
AB
223,329206661
38,7991349512
41,0575754453
58,5919686414
65,0603290585
7-1,009101948-1
820,893818741
929,765796012
10-1,219482284-1
117,4031541431
123,1294082672
1322,747252583
148,9677130294
154,3771106115
1613,911932996
17-3,341311556-1
18-1,71809094-2
1914,382647711
2015,92096992
218,8189230423
2210,875789394
2324,640688685
2410,653086816
2516,503099797
2627,262138218
2727,101565449
28-0,641707551-1
299,4149565281
308,4180361492
31-2,873287388-1
3228,978501441
3329,957900262
3429,432753563
359,8757878134
362,1205505425
3728,628298086
388,3003599117
3924,810205898
4029,533010649
419,80526560110
427,24830752711
4319,2906845212
4417,9224019913
45-3,670679385-1
462,5188179121
4725,167022322
48-0,96252753-1
4912,169566371
500,3258674142
5126,689883433
524,775698734
5319,908025425
5412,350553036
5512,336113367
563,6981088798
57-1,755852633-1
5815,876743641
5924,241572192
6022,450803823
610,902229264
6213,045790365
63-2,206148656-1
64-3,845610364-2
650,7400544571
6618,220573722
6728,842874843
6821,850689794
69-2,542726765-1
7018,732828741
716,8408550552
7215,798473283
737,9833727114
7426,297590025
75-0,816185281-1
763,5307619371
7712,320665462
7829,864586043
7918,880287394
8027,138029455
818,5280053566
8219,864919547
834,6305978878
841,2120260639
8517,7219505910
8614,6897386211
874,05866984712
8823,6762747413
89-1,433072659-1
900,6207246421
917,3808681422
9216,689962163
93-3,967751701-1
9421,111861941
9514,512306652
9626,085183073
979,9514242014
9817,256448185
9922,684343976
10023,190490277
1010,8266110988
Blad2
Cell Formulas
RangeFormula
A2:A101A2=RANDARRAY(100,,-4,30)
B2:B101B2=SUM(IF(COUNT(B1,A2)<>2,0,IF(SIGN(B1)=SIGN(A2),B1)),SIGN(A2))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B1001Other TypeDataBarNO
 
Last edited:
Upvote 0
Here is a sample of the data I'm working with. I think what you are showing me might work but I'm not sure how to apply it to this data. This is actually a pivot table and will continue to grow as I add data to the underlying table. This is a percentage of completed assignments. As the year progresses the "target" percentage continues to increase. What I currently have is conditional formatting showing me that it is not meeting the target. But, what I really want to see is whether they are trending farther and farther away from that target over time. Or, on the other hand, are they holding their own (they might not be reaching the target but they are not getting any farther behind). It would be nice to see a positive trend as well.

Student Progress Eval.xlsm
EFGHIJKLMN
44/26/20224/27/20224/28/20224/29/20225/2/20225/3/20225/4/20225/5/20225/6/20225/9/2022
5
6
776.8077.9679.2080.5882.0082.7483.9685.7486.7088.02
877.4079.0080.6082.3082.3083.9085.5085.5085.5087.10
979.5080.8082.2083.6083.6083.6084.9086.3089.0089.00
1077.4077.4079.6080.6081.7082.8083.9084.9086.0088.20
1176.5077.6078.6079.6080.6081.6083.7084.7085.7086.70
1273.2075.0075.0076.8081.8081.8081.8087.3087.3089.10
1354.4055.2755.2756.0058.4061.0062.0362.9062.9062.90
1462.7064.2064.2064.2067.2067.2067.2068.7068.7068.70
1545.1046.2046.2048.4049.5052.7052.7053.8053.8053.80
1655.4055.4055.4055.4058.5063.1066.2066.2066.2066.20
1769.6670.2672.4674.3076.0076.4877.0278.3879.2480.96
1877.6077.9079.2081.8084.4085.7085.7088.3089.6089.60
1977.8079.4085.7085.7085.7085.7085.7087.3087.3088.90
2073.0073.0075.3075.3078.7078.7078.7079.8080.9085.40
2147.8048.9050.0052.2053.3054.4055.6055.6056.0057.10
2272.1072.1072.1076.5077.9077.9079.4080.9082.4083.80
2365.0267.1668.6269.9470.6871.3872.9076.1277.7479.34
NewSummary
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B5:O130Cell Value<NETWORKDAYS(Calendar!$B$5,B$4,Calendar!$B$13:$B$42)/Calendar!$B$6*100textNO
 
Upvote 0
a variant on this ?
conditional
VBA Code:
Sub kleuren()
     Dim iSgn
     With Range("A5:w21")     'your range
          For i = 1 To .Rows.Count     'loop through the rows
               ptr = 0     'reset counter
               For j = 2 To .Columns.Count     'loop through the columns
                    iSgn = Sgn(.Cells(i, j) - .Cells(i, j - 1))     'actual direction (down=-1, equal=0,up=+1)
                    ptr = -ptr * ((iSgn = Sgn(ptr)) Or (iSgn = 0)) + iSgn     'counter direction
                    maincolor = Application.Min(255, 255 - Abs(ptr) * 5)     'maincolor for green or red in RGB
                    auxcolor = Application.Max(1, 200 - Abs(ptr) * 20)     'the 2 other colors in RGB
                    Select Case ptr
                         Case -1 To 1: .Cells(i, j).Interior.ColorIndex = xlNone
                         Case Is < -1: .Cells(i, j).Interior.Color = RGB(maincolor, auxcolor, auxcolor)
                         Case Else: .Cells(i, j).Interior.Color = RGB(auxcolor, maincolor, auxcolor)
                    End Select
               Next
          Next
     End With
End Sub
 
Upvote 0
That is definitely getting closer to what I'm aiming for. But, the issue is that it's being based on whether the number increased from one day to the next. As a general rule, they will never go down. But, if the number doesn't change it's a negative trend because the number should have increased. So, let's just say that on Monday, their goal is to be at 72% and they are at 71%. Then on Tuesday, they are only at 71.5% but they should be at 73%. This would be a negative trend even though there was an increase. Here is the formula I'm using in my current condition formatting: =NETWORKDAYS(Calendar!$B$5,B$4,Calendar!$B$13:$B$42)/Calendar!$B$6*100

How would I use that condition in the VBA?
 
Upvote 0
@paulkc, this is the row where you check the trend, but i didn't understand the formula, can you give an example
Rich (BB code):
  iSgn = Sgn(.Cells(i, j) - .Cells(i, j - 1))     'actual direction (down=-1, equal=0,up=+1)

@jon Peltrier, your reaction is about #2, not #4, i assume and i don't see a method to use it with what @paulkc demands.
 
Upvote 0
The data examples shown are based on assignments that should have been completed up to the current day. For example, let's say we have a term of 90 days. After the 5th day, this student should be at 5.6% (5/90), after 10 days, he would be at 11.1% (10/90), etc.
Now, let's say that this student was at 4.9% after the first week and at 9.8% after the 2nd. This would be a negative trend because even though he did the same amount of work both weeks (4.9%), his schedule requires 5.6%. So, after the 2nd week, he is farther behind than he was the first week.
The formula I posted in #5 is calculating that expected percentage by calculating the number of workdays between the start of the term which is defined on the Calendar tab in cell B5 and the current day shown above in row 4.
 
Upvote 0
Can you add a link with (that part of) your spreadsheet. With XL2BB it starts in column E and the formulas use B-cells.
 
Upvote 0
Student Progress Eval.xlsm
ABCD
1First Day2021-08-2489
2End 1st2022-01-14
3End 2nd2022-05-27
4
5Current Term Start2022-01-17
6Current Term Days88
7
81st Semester Days89
91st Semester Days to Current89
102nd Semester Days88
112nd Semester Days to Current85
12
13Labor Day2021-09-06
14Retreat
15Convention2021-09-23
16Convention2021-09-24
17Thanksgiving2021-11-25
18Thanksgiving2021-11-26
19Christmas2021-12-20
20Christmas2021-12-21
21Christmas2021-12-22
22Christmas2021-12-23
23Christmas2021-12-24
24Christmas2021-12-27
25Christmas2021-12-28
26Christmas2021-12-29
27Christmas2021-12-30
28Christmas2021-12-31
29President's Day2022-02-21
30Easter2022-04-15
31Easter2022-04-18
32Easter2022-04-19
33Easter2022-04-20
34Easter2022-04-21
35Easter2022-04-22
Calendar
Cell Formulas
RangeFormula
D1D1=NETWORKDAYS(B1,B2,B13:B35)
B8B8=NETWORKDAYS(B1,B2,B13:B35)
B9B9=NETWORKDAYS(B1,MIN(TODAY(),B2),B13:B35)
B10B10=NETWORKDAYS(B2+1,B3,B13:B35)
B11B11=NETWORKDAYS(B2+1,MIN(TODAY(),B3),B13:B35)
 
Upvote 0

Forum statistics

Threads
1,214,539
Messages
6,120,100
Members
448,944
Latest member
SarahSomethingExcel100

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