+ Reply to Thread
Results 1 to 4 of 4

Comparing 2 columns, highlighting the higher number

  1. #1
    Registered User
    Join Date
    09-01-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    2

    Comparing 2 columns, highlighting the higher number

    First, I apologies if this topic does not belong here. If it does not, could someone help me and move the topic.

    What I am trying to do is I have column C and column G. For each row, I want to highlight or change the font color of the greater number. I can do it with conditional formatting, but I am only able to do it for 1 row at a time and it will take forever considering there are over 800 rows. Is there an easy way to compare the two columns and highlight or change the font color of the higher number in that row?

    For example:

    C G
    4 5
    8 1
    6 2
    9 11

    So it would highlight the 5 in the first row, the 8 in the second row, the 6 in the third row, and 11 in the fourth row.

    Thanks
    Last edited by NBVC; 09-01-2009 at 09:27 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Comparing 2 columns, highlighting the higher number

    Depending on how you created the first conditonal format, you can copy the formats to the other rows via Paste Special | Formats

    If you used formulas.. ensure there is no $ in front of referenced row number


    You can do this... select all data and invoke CF
    Formula Is >> =A1=Max($A1,$B1) where A1 and B1 are the top most cells in your selection.
    Last edited by NBVC; 09-01-2009 at 01:19 PM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Comparing 2 columns, highlighting the higher number

    It's still conditional formatting and you will have to do it TWICE, not 800 times, once for each column. You have to keep in mind the use of $ in references makes them absolute, so you have to use them correctly. You want the columns absolute but the rows relative.

    Let's assume the range is rows 2 through 1000.
    1) Highlight C2:C1000
    2) Open the conditional formatting window
    3) Use Condition1: Formula Is: =$C2>$G2
    4) Set your highlight color

    Now you've finished the entire column C, repeat in column G reversing the formula.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    09-01-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Comparing 2 columns, highlighting the higher number

    Thanks for the help, I completely forgot about Paste Special (its been a while since I used excel). I did use your idea Jbeaucaire (I think the first time I might have done $G$2, dunno why) but it works now. Thanks for the help guys.

+ 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