Formula to get the result depending on the color of cell

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello, I have this data in excel sheet where column E has some values. Some of the cells are of 2 different colors. I am trying to get a formula in column D where if the color of the cell is Pink I want it to display B, If it is yellow it should display C, and all other cells it should display A as in the image.
Book1
ABCDE
112345
2A120.00
3A220.00
4B250.00
5B450.00
6A600.00
7A1080.00
8A1080.00
9A1350.00
10B1350.00
11B1440.00
12A1460.00
13A3560.00
14C3560.00
15C3560.00
16A3750.00
17A4640.00
18A4850.00
19C12558.00
20C29400.00
Query
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
how are the colours set, is this set using conditional formatting , if so then can use the same , otherwise VBA would be needed, not my expertise
 
Upvote 0
how are the colours set, is this set using conditional formatting , if so then can use the same , otherwise VBA would be needed, not my expertise
When the data is entered, the cells are colored manually as per requirement. There are more than 10,000 rows. Please I would prefer a formula rather than a VBA.
 
Upvote 0
When the data is entered, the cells are colored manually as per requirement. There are more than 10,000 rows. Please I would prefer a formula rather than a VBA.
It is not possible. Formulas can only run off of values in cells, not the formatting applied to the cells.
If the color is being set manually, a VBA solution is your only option.
 
Upvote 0
It is not possible. Formulas can only run off of values in cells, not the formatting applied to the cells.
If the color is being set manually, a VBA solution is your only option.
I found the solution. Thanks. I filtered the data, each time by one color and entered the required data. Thanks for your response etaf and Joe4
 
Upvote 0
Solution
You could use the old Excel4macro functions
+Fluff 1.xlsm
ABCDE
112345
2A120
3A220
4B250
5B450
6A600
7C1080
8A1080
9A1350
10B1350
11B1440
12A1460
13A3560
14C3560
15C3560
16A3750
17A4640
18A4850
19C12558
20B29400
Master
Cell Formulas
RangeFormula
D2:D20D2=IF(GetColour=40,"B",IF(GetColour=6,"C","A"))


Where GetColour is a defined name using
Excel Formula:
=GET.CELL(63,INDIRECT("rc[1]",0))
 
Upvote 0
Glad you figured out a manageable workaround.
 
Upvote 0
You could use the old Excel4macro functions
+Fluff 1.xlsm
ABCDE
112345
2A120
3A220
4B250
5B450
6A600
7C1080
8A1080
9A1350
10B1350
11B1440
12A1460
13A3560
14C3560
15C3560
16A3750
17A4640
18A4850
19C12558
20B29400
Master
Cell Formulas
RangeFormula
D2:D20D2=IF(GetColour=40,"B",IF(GetColour=6,"C","A"))


Where GetColour is a defined name using
Excel Formula:
=GET.CELL(63,INDIRECT("rc[1]",0))
Thanks Fluff. But it is too complicated for me as I am not good at colors and color codes. Maybe it will help when & if we don't have a filter option for a data. I would like to go with the filter option only.
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,483
Members
448,967
Latest member
visheshkotha

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