If statements in Excel worksheets.


  1. Posts : 491
    Windows 7
       #1

    If statements in Excel worksheets.


    How do you add if statements to formula in Excel that change the formating of the cells.

    For instace:

    If I have a sum which subtracts one cell from another and I want the colour of the text in the results cell to turn red if the value becomes negative.

    And:

    If I have a number in a cell and while the number is say 8 then that is fine so I want nothing to change, but if the number becomes say 3 then I want the colour of text in the cell to turn red, how would I go about it.

    Regards

    AF
      My Computer


  2. Posts : 66
    XP Professional, 7 Professional
       #2

    Man, I haven't had to try this in a long while. I remember it used to be a rule menu called "conditional formatting", but I've never tried it in newer versions of excel. Give me a minute and I try to reacquaint myself.

    EDIT: Home tab, Conditional formatting is it's own button
      My Computer


  3. Posts : 5,941
    Linux CENTOS 7 / various Windows OS'es and servers
       #3

    Hi there
    probably the easiest way is to start to RECORD a Macro (open the development developers ? tag and chose start recording.

    Do your IF or whatever you want in the cell(s) then STOP RECORDING and then look at the VBA code.

    Other than that look at the excel help == I know there are a load of string / conditional formatting statements.

    If you know the range of cells relative to the start column it's probably best to have this in a macro whenever data is entered into the appropriate cells.

    Cheers
    jimbo
      My Computer


  4. Posts : 491
    Windows 7
    Thread Starter
       #4

    mjm6783 said:
    Man, I haven't had to try this in a long while. I remember it used to be a rule menu called "conditional formatting", but I've never tried it in newer versions of excel. Give me a minute and I try to reacquaint myself.

    EDIT: Home tab, Conditional formatting is it's own button

    Thanks for that, I was expecting a pain in the arse formula would have to be inserted but Excel does all the hard work for you.

    Cheers
      My Computer


  5. Posts : 491
    Windows 7
    Thread Starter
       #5

    jimbo45 said:
    Hi there
    probably the easiest way is to start to RECORD a Macro (open the development developers ? tag and chose start recording.

    Do your IF or whatever you want in the cell(s) then STOP RECORDING and then look at the VBA code.

    Other than that look at the excel help == I know there are a load of string / conditional formatting statements.

    If you know the range of cells relative to the start column it's probably best to have this in a macro whenever data is entered into the appropriate cells.

    Cheers
    jimbo
    Thanks for the help but I think the conditional formating will be much easier than having to arse around with macro's.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:24.
Find Us