white84

New Member
Joined
May 11, 2018
Messages
40
Office Version
  1. 365
Platform
  1. Windows
I have data in a table such as this example, tracking recentcompetitions. Most data is in pivot table, but then cells are linked to astandard table. I have conditional formatting to highlight the status of the competition based on Active/Won/Lost (No color/Green/Red).

This is then linked to an XY Scatter plot based on this criteria, with data labelson the scatter plot only showing the customer name, and a box around the namecolored to correspond to the Green/Red Won/Lost status.

When I update monthly and refresh the pivot table, the conditionalformatting works fine in the table but formatting of the data labels on thechart get jumbled (Some active turn a color, some Won/Lost will switch color).
Is there a way to link or set formatting based on a sortof lookup, so I can refresh the data and don’t have to reset the data labelseach time. (Numerous customers, numerous criteria).

Thanks in advance!

Customer Name
Criteria1
Criteria 2
Status
Customer1

5
$3
Won
Customer2
2
$9
Won
Customer3
12
$25
Active
Customer4
7
$11
Lost
Customer5
9
$14
Won

<tbody>
</tbody>
 
IT WORKED!

Thank you VERY much!

For anyone else interested here is my final code. I decided to remove the [White] formatting from "Active" so there was not as much overlap. I also changed the font color to black.

Code:
Sub FormatLabels()
Dim s As Series, y, dl As DataLabel, i%, r As Range
Set r = [k5]
Set s = ActiveSheet.ChartObjects("chartA320").Chart.SeriesCollection(1)
y = s.Values
For i = LBound(y) To UBound(y)
    Set dl = s.Points(i).DataLabel
    Select Case r
        Case Is = "Won"
            dl.Format.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
            dl.Format.Fill.ForeColor.RGB = RGB(5, 250, 5)
        Case Is = "Lost"
            dl.Format.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
            dl.Format.Fill.ForeColor.RGB = RGB(250, 5, 5)
    End Select
    Set r = r.Offset(1)
Next
End Sub
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

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