Is there, in Excel, a Formula that retrieve the ColorIndex (or RGB) of a cell?
I found the follwing function:
CELL(info_type, the_cell)
documented here, but it does not have any reference information for cell color.
The is a color
info, but it's useless for me.
In fact, it is described as follows:
"color"
The value 1 if the cell is formatted in color for negative values; otherwise returns 0 (zero).
Any idea?
Also, I turned out that the VBA property that do this is Cell.Interior.Color
but actually I'm not using Macros, but simple Excel formulas. Is there maybe a way to emulate VBA functions with a formula?
please try with below
Changes made : see the comment in code
Module
Worksheet
Here are some small functions for you. From your sheet, press Alt-F11 to reach the VBA editor, insert a new module, paste the below code, go back to your worksheet and use them by their names, like in
=FillColor(A1)
The first two are the promised "3-liners" giving decimal values for font and background colors - not very useful though
The second pair converts the decimal number to RGB and returns a string of format N, N, N
The third pair are array formulas - select 3 cells in a row, enter the formula and press Ctrl+Shift+Enter to obtain numeric RGB values in 3 neighboring cells
A word of caution: changing the color of a cell does not start recalculation by the above functions/formulas, as recoloring a cell in general is not supposed to drive recalculation. You have to manually start a full recalculation using Ctrl+Alt+Shift+F9
The following function will display the RGB value of a selected cell.