Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
change the color of cell background based on a result
I would like to have the result of my function to change the color of the
cell in which the result is displayed. For example: 1- if the value of cell A1 is less than or equal to the value of cell C2 then display the difference between cells C2 and A1 in cell D4 with a "green" background. or 2- if the value of cell A1 is greater than the value of cell C2 then display the difference between cells C2 and A1 in cell D4 with a "red" background. I can get the "IF" function to display the numeric value I want, but cannot get the background shading to change with the perameters I specified above. Any help would be appreciated. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
change the color of cell background based on a result
A formula cannot change any type of cell formatting. It can only return a value to the cell whence it was called. You can use Conditional Formatting (from the Format menu) to change the formatting of a cell based on the cell's value or based on the result of another formula. Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Tue, 27 Jan 2009 10:43:01 -0800, Rich wrote: I would like to have the result of my function to change the color of the cell in which the result is displayed. For example: 1- if the value of cell A1 is less than or equal to the value of cell C2 then display the difference between cells C2 and A1 in cell D4 with a "green" background. or 2- if the value of cell A1 is greater than the value of cell C2 then display the difference between cells C2 and A1 in cell D4 with a "red" background. I can get the "IF" function to display the numeric value I want, but cannot get the background shading to change with the perameters I specified above. Any help would be appreciated. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
change the color of cell background based on a result
A formula cannot affect the formatting in a cell - you do this with
conditional formatting. Select cell D4 and then click on Format | Conditional Formatting. In the panel that pops up, select Formula Is rather than Cell Value Is in the first box. In the next box you should enter this formula: =A1<=C2 Then click on the Format button, select the Patterns tab (for background colour) and choose Green. Click OK and then Add to set up your second condition. Select Formula Is as before, and use this formula: =A1C2 Click the Format button and choose Red on the Patterns tab. Click OK twice to exit the dialogue boxes. Hope this helps. Pete On Jan 27, 6:43*pm, Rich wrote: I would like to have the result of my function to change the color of the cell in which the result is displayed. For example: 1- if the value of cell A1 is less than or equal to the value of cell C2 then display the difference between cells C2 and A1 in cell D4 with a "green" background. or 2- if the value of cell A1 is greater than the value of cell C2 then display the difference between cells C2 and A1 in cell D4 with a "red" background.. I can get the "IF" function to display the numeric value I want, but cannot get the background shading to change with the perameters I specified above. Any help would be appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change background color based on value in column A | Excel Discussion (Misc queries) | |||
Auto change background of color based on formula | Excel Worksheet Functions | |||
Changing background color based on different cell | Excel Discussion (Misc queries) | |||
change background row color with change of date in a cell | Excel Discussion (Misc queries) | |||
Change font and background color of several cells based on result of a formula | Excel Discussion (Misc queries) |