cell value from a colour

j4ymf

Well-known Member
Joined
Apr 28, 2003
Messages
743
Office Version
  1. 365
Platform
  1. Windows
hello all

at work they like to use colours to indicate a value

red = 3
green = 2
yellow = 1

is there a formula that if the cell is red = 3

so what I'm after is,
if A1 is red in colour in B1 the cell = 3
formula = if red= 3, green = 2, yellow = 1


please help if you get what I'm on about
thank you
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You can use a UDF.

Code:
Function ColorVal(r As Range) As Variant
With r
    Select Case .Interior.ColorIndex
        Case 3
            ColorVal = 3
        Case 4
            ColorVal = 2
        Case 6
            ColorVal = 1
        Case Else
            ColorVal = "N/A"
    End Select
End With
End Function
 
Upvote 0
hello irobbo314, thank you for you reply

How do I use this formula
or how do I call back the answers

if Im using A1 to A10 with colour cells how do I find the answer

B1 = ColorVal total????
 
Upvote 0
Follow the directions in my signature to paste the code. Then use it like a normal formula. In the worksheet type =ColorVal(B1)
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

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