+ Reply to Thread
Results 1 to 5 of 5

Formatting 2 cells based on another cell

  1. #1
    Registered User
    Join Date
    06-13-2011
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    27

    Question Formatting 2 cells based on another cell

    Hi there,

    I have attached a sample spreadsheet to show you what I mean by this.

    Formatting Test.xlsx

    If cell B is less than or equal to cell C, for both of them to be filled green.

    If Cell B is more than cell C then not to format anything.

    Also, is there a quick way to copy this formula as I have other sheets which use the same information (but don't use cells B & C)?

    Many thanks,
    Gary

  2. #2
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Formatting 2 cells based on another cell

    Select cells B2 and C2 and add a conditional format with a rule that uses a formula. This is the formula

    =$B2<=$C2

    Set the format to a green fill.

    You can copy the two cells and use Paste Special > Formats to apply the same formatting to other rows.

    If you want the formatting to work in other columns than B and C, you will need to set up individual rules for each column. The cell references are relative to the current cell, so you need to construct your formulas accordingly.
    Last edited by npamcpp; 08-03-2012 at 07:53 AM.
    Like a post? Click the star below it!

  3. #3
    Registered User
    Join Date
    06-13-2011
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Formatting 2 cells based on another cell

    Excellent, thanks very much. I didn't realise you could put one dollar sign... I thought they could only be $B$2 for example!

    Exactly what I wanted.

  4. #4
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Formatting 2 cells based on another cell

    mind you that $B1 copied across will always refer to column B.

    You may want to learn a bit more about absolute and relative cell references.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Formatting 2 cells based on another cell

    @ snaxxy

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1