cell value from a colour

j4ymf

Well-known Member
Joined
Apr 28, 2003
Messages
741
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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,215,655
Messages
6,126,054
Members
449,283
Latest member
GeisonGDC

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