How to copy the cell format while using the "IF" function.

H

Haren Jethwa

I wnat to execute an IF function which returns a value (cell content) to another cell. I like to know how If finction returns not just the cell content but also its format. e.g.
if A1=555, ( A1 is formatted so that the font is Blue)
A2=555 (A2 is formattted so that the font color is Red)
A3=1
A4 is an empty cell and formatted so that font color is Black.
in A4 if I use IF function as ...If(A3=1,A1,A2)
When the value returns I like to see 555 in blue font and not black
How can I do this...please help....Thanks
 
F

Frank Kabel

Hi Haren

a formula cannot change the cell format. Two possible workarounds
1. use conditional formating to achieve the formats you want based on
the cell value(e.g. for A4 enter the formula "=A3=1" in the conditional
format dialog and set the font color accordingly)

2. Use VBA and process the worksheet_change event.

HTh
Frank
 

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