Link to home
Create AccountLog in
Avatar of whorsfall
whorsfallFlag for Australia

asked on

Excel 2007 Conditional formatting based on a function value.

Hi,

I am trying to work out how to do this in Excel 2007.

I would like to do a conditional formatting based on a return
value of a function.

If the function returns "True". I want the cell formatted as green.
If the function returns "False", I want the cell formatted as red.

So I have created the VBA function, what I am stuck on is how to do the
conditional formatting in Excel 2007.

I am looking for the basic steps.

Thanks,

Ward.

 
Avatar of andrewssd3
andrewssd3
Flag of United Kingdom of Great Britain and Northern Ireland image

On the Home tab - conditional formatting, then New rule... and choose 'Use a formula to determine which cells to format.  Then you can enter your function, and select the formatting you want
ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of whorsfall

ASKER

Hi,

Thanks for that but I am a bit confused. I can see how to set the formatting for true,
but how then do I format it for False?

Thanks,

Ward.
did you check the file I posted ?
gowflow
You use two conditional formatting rules.
One rule for TRUE and one rule for False.
   OR - you can format the cell for FALSE and only test for TRUE.
I presume you have loaded the file I posted
1) once loaded goto menu Home and click on the arrow under Conditional formating
2)Select Manage rules
3) you will see 2 rules the first one Cell Value = FALSE then Red color and the second one Cell value = TRUE then Green color.
4) if you want to modify this click on the rule you want click edit then you will see the data and can change the conditio nand the color.

gowlfow
Again when you say
but how then do I format it for False?
If your confused on how empty cells are turned Red is that by delfault empty = 0 = false so if your not happy with all cells turning red by default then change the output of your formula to be say Yes and No and then affect Yes to Green and No to Red this way only input of formula will be colored and empty cells will remain blank !!!
gowflow
Excellent !