Add color in symbol

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
884
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team,

Need to add color in arrow only with Green and Red

01 FS Grouping_Fix Macro.xlsx
ABCDEFGHIJKLMN
1
2
3ABCXABCX
4
5SEEN AD (NET)19 ▼1522 ▼16SEEN AD (NET)19 X1522 X16
6Correctly Branded (net)3.87 ▼3.674.09 ▼3.68Correctly Branded (net)3.87 X3.674.09 X3.68
7The Ad Is Likeable3.153.143.173.19The Ad Is Likeable3.153.143.173.19
8The Ad Told Me Something New2.83 ▲2.842.832.92 AThe Ad Told Me Something New2.832.842.832.92 A
9Top 2 Box (net)2.75 ▲2.69 ▲2.82 ▲2.95 ABCTop 2 Box (net)2.752.692.822.95 ABC
10Top 2 Box (net)2.912.992.84 Top 2 Box (net)2.912.992.84
11
12The Ad Is Likeable3.27 ▼3.23.353.25The Ad Is Likeable3.27 X3.203.353.25
13The Ad Told Me Something New3 ▲2.97 ▲3.04 ▲3.22 ABCThe Ad Told Me Something New3.002.973.043.22 ABC
14It Made Me Want To Visit The Dealership Or Take A Test Drive2.93 ▲2.9 ▲2.97 ▲3.16 ABCIt Made Me Want To Visit The Dealership Or Take A Test Drive2.932.902.973.16 ABC
15The Ad Made Me Want To Find Out More About The Vehicle (search Online/read Articles)3.323.263.37 The Ad Made Me Want To Find Out More About The Vehicle (search Online/read Articles)3.323.263.37
16The Ad Made Me Want To Find Out More About The Brand3.143.153.13 The Ad Made Me Want To Find Out More About The Brand3.143.153.13
17This Is The Sort Of Ad I Would Talk To Others About3.07 ▲3.08 ▲3.05 ▲3.28 ABCThis Is The Sort Of Ad I Would Talk To Others About3.073.083.053.28 ABC
grouping
Cell Formulas
RangeFormula
D5:G10,D12:G17D5=SUBSTITUTE(K5,"X","")&" "&IFERROR(IF(FIND(D$3,$N5),$A$2,""),"")&IFERROR(IF(FIND($G$3,K5),$A$3,""),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
K5:M27Expression=FIND($N$3,K5)textNO
K5:M27Expression=FIND(K$3,$N5)textNO
H5:I26Expression=FIND("M",#REF!)textNO
H5:I26Expression=FIND("N",#REF!)textNO


Regards,
Sanjeev
 
That should be doable if you absolutely need that, But I need some sleep right now. I should be back on in about 12 hrs.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Well, it is not doable because of the formulas.

Hi Johnny,
I have removed the formula and only add the data with Arrow only I hope now we can do it :)

book1
CDEFG
5SEEN AD (NET)19 ▼1522 ▼16
6Correctly Branded (net)3.87 ▼3.674.09 ▼3.68
7The Ad Is Likeable3.153.143.173.19
8The Ad Told Me Something New2.83 ▲2.842.832.92 A
9Top 2 Box (net)2.75 ▲2.69 ▲2.82 ▲2.95 ABC
10Top 2 Box (net)2.912.992.84
11
12The Ad Is Likeable3.27 ▼3.23.353.25
13The Ad Told Me Something New3 ▲2.97 ▲3.04 ▲3.22 ABC
14It Made Me Want To Visit The Dealership Or Take A Test Drive2.93 ▲2.9 ▲2.97 ▲3.16 ABC
15The Ad Made Me Want To Find Out More About The Vehicle (search Online/read Articles)3.323.263.37
16The Ad Made Me Want To Find Out More About The Brand3.143.153.13
17This Is The Sort Of Ad I Would Talk To Others About3.07 ▲3.08 ▲3.05 ▲3.28 ABC
Sheet1
 
Upvote 0
You can leave all formulas in your sheet.

The following code will remove any formula that gets in the way of changing the color of the triangle in the columns D - F range:

VBA Code:
Sub ColorTrianglesInCells()                                             ' Up triangle = ChrW(9650) ... Down triangle = ChrW(9660) <-- Decimal values of the Hex
'                                                                       ' Up triangle = Unicode Hex 25B2 ... Down triangle = Unicode Hex 25BC
    Dim LastRow As Long
    Dim Cel     As Range
    Dim WS      As Worksheet
'
    Set WS = Sheets("Sheet1")                                               ' <--- Change to actual sheet name desired
'
    LastRow = WS.Range("D" & Rows.Count).End(xlUp).Row                      ' Find the row of the last line of data in Column D
'
    For Each Cel In WS.Range("D1:F" & LastRow)                              ' Range loop
        If Right(Cel.Value, 1) = ChrW(9650) Then                            '   If cell ends with an up triangle then ...
            Cel.Value = Cel.Value                                           '       Remove the formula from the cell to allow a partial color change
            Cel.Characters(Start:=Len(Cel), Length:=1).Font.Color = vbGreen '       Color the triangle Green
        ElseIf Right(Cel.Value, 1) = ChrW(9660) Then                        '   If cell ends with a down triangle then ...
            Cel.Value = Cel.Value                                           '       Remove the formula from the cell to allow a partial color change
            Cel.Characters(Start:=Len(Cel), Length:=1).Font.Color = vbRed   '       Color the triangle Red
        End If
    Next                                                                    ' Loop back
End Sub

Be sure to set the proper sheet name at the top of the code. ;)
 
Upvote 0
Solution
Give this macro a try...
VBA Code:
Sub ColorTriangles()
  Dim Cell As Range
  For Each Cell In Range("D5", Cells(Rows.Count, "G").End(xlUp))
    If Len(Cell.Value) Then
      If AscW(Right(Cell.Value, 1)) = 9650 Then
        Cell.Characters(Len(Cell.Value) - 1).Font.Color = 5287936
      ElseIf AscW(Right(Cell.Value, 1)) = 9660 Then
        Cell.Characters(Len(Cell.Value) - 1).Font.Color = vbRed
      End If
    End If
  Next
End Sub

HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (ColorTriangles) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
Give this macro a try...
VBA Code:
Sub ColorTriangles()
  Dim Cell As Range
  For Each Cell In Range("D5", Cells(Rows.Count, "G").End(xlUp))
    If Len(Cell.Value) Then
      If AscW(Right(Cell.Value, 1)) = 9650 Then
        Cell.Characters(Len(Cell.Value) - 1).Font.Color = 5287936
      ElseIf AscW(Right(Cell.Value, 1)) = 9660 Then
        Cell.Characters(Len(Cell.Value) - 1).Font.Color = vbRed
      End If
    End If
  Next
End Sub

HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (ColorTriangles) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.


Thank you So much Sir......:)

I work very well as per the requirement:):).

Regards,
Sanjeev
 
Upvote 0
You can leave all formulas in your sheet.

The following code will remove any formula that gets in the way of changing the color of the triangle in the columns D - F range:

VBA Code:
Sub ColorTrianglesInCells()                                             ' Up triangle = ChrW(9650) ... Down triangle = ChrW(9660) <-- Decimal values of the Hex
'                                                                       ' Up triangle = Unicode Hex 25B2 ... Down triangle = Unicode Hex 25BC
    Dim LastRow As Long
    Dim Cel     As Range
    Dim WS      As Worksheet
'
    Set WS = Sheets("Sheet1")                                               ' <--- Change to actual sheet name desired
'
    LastRow = WS.Range("D" & Rows.Count).End(xlUp).Row                      ' Find the row of the last line of data in Column D
'
    For Each Cel In WS.Range("D1:F" & LastRow)                              ' Range loop
        If Right(Cel.Value, 1) = ChrW(9650) Then                            '   If cell ends with an up triangle then ...
            Cel.Value = Cel.Value                                           '       Remove the formula from the cell to allow a partial color change
            Cel.Characters(Start:=Len(Cel), Length:=1).Font.Color = vbGreen '       Color the triangle Green
        ElseIf Right(Cel.Value, 1) = ChrW(9660) Then                        '   If cell ends with a down triangle then ...
            Cel.Value = Cel.Value                                           '       Remove the formula from the cell to allow a partial color change
            Cel.Characters(Start:=Len(Cel), Length:=1).Font.Color = vbRed   '       Color the triangle Red
        End If
    Next                                                                    ' Loop back
End Sub

Be sure to set the proper sheet name at the top of the code. ;)

Awesome!!!!! Always happy with this team and get assistance in our hard times :):)
 
Upvote 0
Glad we could help @sksanjeev786.


Hi Team,

Hope you are doing well :)

Just wanted to check I have changed the Arrow font from Ariel to Wingding 3 and now getting C and E data instead of Arrow.
I know it bit tricky but is it possible? to have arrow I have kept in A2 and A3 or Any idea if you can give to me :)

For arrow ref. i have attached the Screen shot

book1
ABCDEFG
1
2Ç
3ÈABCX
4
5SEEN AD (NET)19 Ç1522 Ç16
6Correctly Branded (net)3.87 Ç3.674.09 Ç3.68
7The Ad Is Likeable3.153.143.173.19
8The Ad Told Me Something New2.83 È2.842.832.92 A
9Top 2 Box (net)2.75 È2.69 È2.82 È2.95 ABC
Sheet1
 

Attachments

  • 111.png
    111.png
    12.2 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,846
Members
449,194
Latest member
HellScout

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