How to return the color of a cell

  • Thread starter Ussama.elghonamy
  • Start date
U

Ussama.elghonamy

Dear Sir

how to return the color code of a cell using excel formulas "not VBA
macros".i mean
if i have two cells and i need to know the color code of the two cells
(light yellow or yellow or red or even the color index of them)

i will appreciate if you reply to me ASAP

thanks & Best regrads
 
N

Nigel

Not possible using Formula. VBA easy, you could use a VBA function?

The closest is if the color is being set by a conditional format, then
indirectly you could get the color knowing the condition, but I suspect that
is not what you want.
 
P

Peter T

As Nigel says there are no built in formulas to return cell formats, though
you could use an old XL4macro in a Named formula

Assuming you will always want to refer to a cell one to the left in same
row, start by selecting cell B1

Define this name Ctrl-F3
Name: ForeColor
RefersTo: =GET.CELL(38,A1)

In any cell one to the right of whose interior colorindex you want to return
enter
=ForeColor

Will return 1-56 or 0 if no fill.

It will not automatically update if you reformat, press Ctrl-Alt-F9 to
recalc.

Regards,
Peter T
 
P

Peter T

As Nigel says there are no built in formulas to return cell formats, though
you could use an old XL4macro in a Named formula

Assuming you will always want to refer to a cell one to the left in same
row, start by selecting cell B1

Define this name Ctrl-F3
Name: ForeColor
RefersTo: =GET.CELL(38,A1)

In any cell one to the right of whose interior colorindex you want to return
enter
=ForeColor

Will return 1-56 or 0 if no fill.

It will not automatically update if you reformat, press Ctrl-Alt-F9 to
recalc.

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top