Excel IF statement

motorbo, Feb 5, 10:21pm
ok ive found a different way to fix my issue but im keen to know why this one wont work, any excel whizz`s here? or anyone know the best site for me to go to. to ask, cheers
$C$2).Font.ColorIndex = 3","Range($C$2).Font-
.ColorIndex = 0")

vtecintegra, Feb 5, 10:33pm
Define 'won't work'.

What are you expecting it to do?

king1, Feb 5, 10:39pm
Range($C$2) doesn't look right

range isn't a function that I know of
if its a tab name it should have a ! after it

Are you mixing some VBA in with it. Haven't done much with VBA in excel but I didn't think it could be used in a formula

motorbo, Feb 6, 5:40am
I ended up using s simple formula I will hide then applied conditional formatting, yes king it was vba that I was trying to put into an if statement to say if this this cell is greater than or equal to to have it change text colour. which I know you can do in conditional formatting but I also wanted the if statement to contain a simple equation, so it would read if cell is greater than or equal to cell minus 50 then turn the font red, if not then keep it black. so whilst I found a solution It was still bugging me that I couldn't do it with an if statement even without the minus

emmerson1, Feb 8, 11:01am
I don't think that's going to work. You use the If construct to change the value of the cell the formula is linked to. So your formula would happily set the cell contents to "Range($c$2).Font.ColorIn-
dex=3" - unless you can then get Excel to 'run' the cell contents as a macro or program, it wont change any cell properties.

I have always used the conditional formatting - it is pretty powerful once you understand it.

If you are into vba, you can set up you own routines, the following link seems useful if you want to go this route.

gyrogearloose, Sep 2, 11:17pm
I think you have to use conditional formatting to change color, there's some restriction which means you can't do it in a statement.

Share this thread

Buy me a coffee :)Buy me a coffee :)