+ Reply to Thread
Results 1 to 13 of 13

Conditional Formating based on a different column

  1. #1
    Forum Contributor
    Join Date
    11-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    212

    Conditional Formating based on a different column

    I don't know why but I can't make my conditional formatting work right. In column G I have a formula that produces a number. I want to compare that to the number in column B (same row) and if G is larger, fill the cell with blue. I've tried two or three different ways and can't get it to work. What is the correct syntax?

    Thank you,
    "Laugh? I thought I'd die!"

    Jimbo?

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Conditional Formating based on a different column

    does this help?
    Attached Files Attached Files
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Contributor
    Join Date
    11-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    212

    Re: Conditional Formating based on a different column

    I hadn't see that option. I tried it but it didn't work. I've checked that the two cells in question are formatted as numbers, so I don't know what they heck I'm doing wrong. I've attached a sample. G5 should be highlighted, and G12 should not. The rest of G doesn't need the formatting rule.
    Attached Files Attached Files

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Conditional Formating based on a different column

    A note about formatting.....formatting never changes the actual data, only how it's presented...the issue was the data in Col B is text. A little trick I do sometimes is multiple my "number" by 1 and then XL forces it to be a real number, not a text number...check out the file...
    Attached Files Attached Files

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Conditional Formating based on a different column

    did this get updated?....I think the website burped when I went to send this....

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Conditional Formating based on a different column

    Quote Originally Posted by judgeh59 View Post
    A note about formatting.....formatting never changes the actual data, only how it's presented...the issue was the data in Col B is text. A little trick I do sometimes is multiple my "number" by 1 and then XL forces it to be a real number, not a text number...check out the file...
    What judgeh59 says works, only I put a double unary in front of $B$5 like this =--$B$5.
    Your formatting kicked right in.

    judgeh59 applied this directly to your spreadsheet formula. I applied mine in the conditional formatting formula. Either way works.
    Last edited by FlameRetired; 08-26-2014 at 06:42 PM.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Conditional Formating based on a different column

    Quote Originally Posted by judgeh59 View Post
    did this get updated?....I think the website burped when I went to send this....
    Downloaded fine for me.

  8. #8
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Conditional Formating based on a different column

    @FlameRetired......thanks...I wasn't even sure the post actually made it.....thanks again....

    I like the idea of the "--"....but the other side is if the data is actually supposed to be a number then the "--" in the CF doesn't change the data....

    like you said though - potato, potaatoe, tater...

  9. #9
    Forum Contributor
    Join Date
    11-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    212

    Re: Conditional Formating based on a different column

    only I put a double unary in front of $B$5 like this =--$B$5.
    Not sure what this means/does

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Conditional Formating based on a different column

    Quote Originally Posted by judgeh59 View Post
    @FlameRetired......thanks...I wasn't even sure the post actually made it.....thanks again....

    I like the idea of the "--"....but the other side is if the data is actually supposed to be a number then the "--" in the CF doesn't change the data....

    like you said though - potato, potaatoe, tater...
    Good point. Wasn't sure what OP was after. Just in case they wanted the 4 to remain as text (probably not likely) I thought it was worth including. Thanks, though.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Conditional Formating based on a different column

    Quote Originally Posted by jimboryan View Post
    Not sure what this means/does
    The double unary does the same thing as *1 or +0 or /1 or ^1. It coerces numbers that are text into their numeric value. I use -- because it's faster to type and I'm lazy. I figured since it works in sp'sheet formula it probably would work in CF formula. Used in CF it leaves the text "value" in B5 unmolested while instructing G5 to turn blue.

    If you want what's in B5 to evaluate as a numeric value go with what judgeh59 suggests. In CF =--$B$5 merely 'tells' G5 to treat B5 as if it were an actual number with value of 4.

    It depends on what you are wanting overall. In either event G5 turns blue.

    Does this help?
    Last edited by FlameRetired; 08-26-2014 at 07:06 PM.

  12. #12
    Forum Contributor
    Join Date
    11-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    212

    Re: Conditional Formating based on a different column

    Thanks for the explanation, and the solution seems to work. Thanks twice!

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,745

    Re: Conditional Formating based on a different column

    Quote Originally Posted by jimboryan View Post
    Thanks for the explanation, and the solution seems to work. Thanks twice!
    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Conditional Formating based on day of the week
    By rizmomin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-12-2013, 01:56 PM
  2. Conditional Row Formating based on one cell of the row
    By Aredmon25 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2012, 11:37 AM
  3. conditional formating based on other cell value
    By tinkerbelle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2009, 01:41 PM
  4. [SOLVED] Conditional Formating Based on Date
    By Roy in forum Excel General
    Replies: 5
    Last Post: 06-07-2006, 11:55 AM
  5. Conditional formating 1 column based on another?
    By scottwilsonx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2005, 06:37 AM

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