need arrow based on cell color

sksanjeev786

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

I need a arrow based on A1 to G11 so what ever we have cell color same color I need in Arrow from A15 (example) including data...

A15 onward arrow should be in color up arrow green and red arrow down and data will remain black




book3
ABCDEFGHIJ
153373816111311RGB RED
2103740131014111460255
310383815713102080
46341441910119800
556394216121511
663314017151212GreenRed
760474322121917
865495527241615
952414117151315
1072405317121416
1158304513151413
12
13
14Output need from A1 to G11
1553 ▲
1655 ▼
1754 ▲
18
Sheet2
Cell Formulas
RangeFormula
H15H15=UNICHAR(9660)
H16H16=UNICHAR(9650)
 
@sksanjeev786 why not use the built in conditional formatting icons (assuming that the green 17 in post one is incorrect and that the exact shade of red and green isn't that important)?

1732092534593.png


1732091638426.png



Book1
ABCDEFG
153373816111311
210374013101411
31038381571310
46341441910119
556394216121511
663314017151212
760474322121917
865495527241615
952414117151315
1072405317121416
1158304513151413
12
13
14Output need from A1 to G11
1553373816111311
1610374013101411
171038381571310
186341441910119
1956394216121511
2063314017151212
2160474322121917
2265495527241615
2352414117151315
2472405317121416
2558304513151413
Sheet5
Cell Formulas
RangeFormula
A15:G25A15=A1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A15:G25Other TypeIcon setNO
 
Last edited:
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hello! Remove the last two rules where the number 20 is compared. Then edit the remaining rules by indicating the format of the number with the arrow. You should have this
 
Upvote 0
@sksanjeev786 What result do you get with the code below?

Please note that I have used the color code for green based on your xl2bb in post one, as the RGB numbers you posted for green do not come out as green for me (this might need adjusting as I can't 100% trust that the XL2BB is exact).

Obviously I still think you need to look at the green up arrow in D9

VBA Code:
Sub ColorArrow2()
    Dim myCell As Range
    Application.ScreenUpdating = False
    
    For Each myCell In Range("A1:G11")
        
        If myCell.Interior.ColorIndex = xlNone Then
            myCell.Offset(14).Value = myCell.Value
        Else
            If myCell.Interior.Color = 5296274 Then  '  The RGB you quoted doesn't come out as green to me
                myCell.Offset(14) = myCell.Value & "    " & ChrW(9650)
                myCell.Offset(14).Characters(Len(myCell.Offset(14))).Font.Color = 5296274
            Else
                myCell.Offset(14) = myCell.Value & "    " & ChrW(9660)
                myCell.Offset(14).Characters(Len(myCell.Offset(14))).Font.Color = 255
            End If
        End If

    Next
    
    Range("A15:G25").HorizontalAlignment = xlLeft

End Sub

The results I get with the code are...

1732107713135.png
 
Upvote 0
Hello! Remove the last two rules where the number 20 is compared. Then edit the remaining rules by indicating the format of the number with the arrow. You should have this

Thank you so much for looking into it.

Sure! I will check and let you know if I have any questions :)
 
Upvote 0
@sksanjeev786 What result do you get with the code below?

Please note that I have used the color code for green based on your xl2bb in post one, as the RGB numbers you posted for green do not come out as green for me (this might need adjusting as I can't 100% trust that the XL2BB is exact).

Obviously I still think you need to look at the green up arrow in D9

VBA Code:
Sub ColorArrow2()
    Dim myCell As Range
    Application.ScreenUpdating = False
   
    For Each myCell In Range("A1:G11")
       
        If myCell.Interior.ColorIndex = xlNone Then
            myCell.Offset(14).Value = myCell.Value
        Else
            If myCell.Interior.Color = 5296274 Then  '  The RGB you quoted doesn't come out as green to me
                myCell.Offset(14) = myCell.Value & "    " & ChrW(9650)
                myCell.Offset(14).Characters(Len(myCell.Offset(14))).Font.Color = 5296274
            Else
                myCell.Offset(14) = myCell.Value & "    " & ChrW(9660)
                myCell.Offset(14).Characters(Len(myCell.Offset(14))).Font.Color = 255
            End If
        End If

    Next
   
    Range("A15:G25").HorizontalAlignment = xlLeft

End Sub

The results I get with the code are...

View attachment 119474

Thank you so much for providing the macro I will check and let u know if I have any questions :)

Really appreciate your hard work on this :)
 
Upvote 0
Hello! Remove the last two rules where the number 20 is compared. Then edit the remaining rules by indicating the format of the number with the arrow. You should have this
could you please share the formula i can not able to open the image :)
 
Upvote 0
Thank you so much for providing the macro I will check and let u know if I have any questions :)

Really appreciate your hard work on this :)
Hi Sir,

I have tried with the macro and getting below result

arrow has not applied in all the color cell and I need only 1 space after data.. currently I am getting more space after data...

book1
ABCDEFG
153373816111311
210374013101411
31038381571310
46341441910119
556394216121511
663314017151212
760474322121917
860495527241615
952414117151315
1072405317121416
1158304513151413
12
13
14
1553 ▲37 ▲38 ▲16111311
1610 ▼37 ▲40 ▲13101411
1710 ▼38 ▲38 ▲15 ▲71310
1863 ▲41 ▲44 ▲1910 ▼119
1956 ▲39 ▲42 ▲16121511
2063314017 ▼151212
2160 ▲47 ▲43 ▲22121917
2260 ▲49 ▲55 ▲27 ▲241615
2352 ▲41 ▲41 ▲17 ▲1513 ▼15
2472 ▲40 ▲53 ▲17121416
2558304513 ▼151413
Sheet1 (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:G11Cell Value>20textNO
A1:G11Cell Value<20textNO
 
Upvote 0
Book1.xlsm
ABCDEFGHIJ
153▲37▲38▲16111311RGBRED
210▼37▲40▲131014111460255
310▼38▲38▲15▲713102080
463▲41▲44▲1910▼119800
556▲39▲42▲16121511
663314017▼151212GreenRed
760▲47▲43▲221219175296274255
865▲49▲55▲27▲241615
952▲41▲41▲17▲1513▼15
1072▲40▲53▲17121416
1158304513▼151413▲▼
12
13
14Output need from A1 to G11
1553 ▲
1655 ▼
1754 ▲
Таблица12
Cell Formulas
RangeFormula
I7I7=COLOR_FILLS(A1)
J7J7=COLOR_FILLS(A3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:G11Expression=COLOR_FILLS(A1)=5296274textNO
A1:G11Expression=COLOR_FILLS(A1)=255textNO
 
Upvote 0
Book1.xlsm
ABCDEFGHIJ
153▲37▲38▲16111311RGBRED
210▼37▲40▲131014111460255
310▼38▲38▲15▲713102080
463▲41▲44▲1910▼119800
556▲39▲42▲16121511
663314017▼151212GreenRed
760▲47▲43▲221219175296274255
865▲49▲55▲27▲241615
952▲41▲41▲17▲1513▼15
1072▲40▲53▲17121416
1158304513▼151413▲▼
12
13
14Output need from A1 to G11
1553 ▲
1655 ▼
1754 ▲
Таблица12
Cell Formulas
RangeFormula
I7I7=COLOR_FILLS(A1)
J7J7=COLOR_FILLS(A3)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:G11Expression=COLOR_FILLS(A1)=5296274textNO
A1:G11Expression=COLOR_FILLS(A1)=255textNO

Hi,

I don't know if am missing any things but not getting any arrow after applying the conditional formatting

1732119844915.png
 
Upvote 0
To do this, you must use the "symbol" menu to insert the arrows into any cell. T.K. These are ordinary characters, they need to be copy, go into the cell format and choose the last item "Custom". We write 0 into the line "type" and insert the arrow up next to it. We do the same with another arrow. As a result, you will have two entries with arrows in your user format list. Next, edit conditional formatting rules. To do this, for each of them, install the cell format, I choose the early added "0" with the arrow. Until you indicate the range of cells for which these rules will work. You have in the first rule, formatting will only be applied to cell "A".
 
Upvote 0

Forum statistics

Threads
1,223,887
Messages
6,175,199
Members
452,617
Latest member
Narendra Babu D

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