if statements excel

Posted on 2011-10-25
Last Modified: 2012-08-13
If i want a cell to say this.. how would i write in excel formula. if cell c5 is less than c3 then turn the font red....if the c5 is equal to then font color be black...if c5 is greater than c3 than font color be green....its doesnt ahve to be font color either it can be cell color...

Question by:chefkeifer
    LVL 80

    Accepted Solution

    You have to use Conditional Formatting for this purpose. You will want 2 rules:
    =C$5<C$3                    red font
    =C$5>C$3                    green font

    The normal font color (used when C5=C3) will be black

    In Excel 2007 and 2010, you find Conditional Formatting in the Home menu. You want "New Rule..." and "Use a formula to determine which cells to format"

    I added the $ to the formulas in case you want to compare other columns on rows 3 and 5. If so, select all the cells before opening the Conditional Formatting menu item.

    Author Comment

    can you apply two rules to the same cell...not sure how to do that...
    LVL 80

    Expert Comment

    In Excel 2003 (and earlier), you can apply 3 rules to the same cell. Excel 2007 and later let you apply many more rules. Just keep clicking the New Rule button while your cells are selected.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
    Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now