+ Reply to Thread
Results 1 to 8 of 8

Conditional Formatting - comparing numbers

  1. #1
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Phoenix, Az
    MS-Off Ver
    MS Office 365
    Posts
    144

    Conditional Formatting - comparing numbers

    I attempting to develop a spreadsheet that will compare the first three numbers in one column with the first three numbers in another.

    The project i am doing is related to zip codes and need to be able to compare.

    For example -

    Zip code in Milwaukee - "53217"
    First three digits for that part of the country - "532 - midwest"

    I would like to use conditional formatting, but not sure how to create the formula.

    Thanks.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Conditional Formatting - comparing numbers

    can you attach a sample spreadsheet

    are you comparing say cell A1 with everything in column B for example

    maybe something like

    =AND(A1<>"",COUNTIF($B$1:$B$100,LEFT(A1,3))>0)
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Phoenix, Az
    MS-Off Ver
    MS Office 365
    Posts
    144

    Re: Conditional Formatting - comparing numbers

    Wayne - Per your request, I am attching a version of the spreadsheet. What I am looking for is to compare the first 3 digits with the "main zip code" to the first three digits of the "Regional Zip Code" just to make sure things align correctly.

    Thanks.
    dave
    Attached Files Attached Files

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Conditional Formatting - comparing numbers

    try
    =AND(B5<>"",COUNTIF(E$5:E$22,LEFT(B5,3)&"*")>0)

    see attached

    for 2007 or 2010 excel version
    Conditional Formatting

    Highlight applicable range >>

    B5:B100


    Home Tab >> Styles >> Conditional Formatting
    New Rule >> Use a formula to determine which cells to format
    Edit the Rule Description: Format values where this formula is true:

    =AND(B5<>"",COUNTIF(E$5:E$22,LEFT(B5,3)&"*")>0)

    Format… [Number, Font, Border, Fill]
    choose the format you would like to apply when the condition is true
    OK >> OK
    Last edited by etaf; 04-22-2014 at 03:47 PM.

  5. #5
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Phoenix, Az
    MS-Off Ver
    MS Office 365
    Posts
    144

    Re: Conditional Formatting - comparing numbers

    Wayne - one more question. How do i do the formula if I want to make all things "False" fill up with color?

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Conditional Formatting - comparing numbers

    OK - so I would just add a NOT in front to change the TRUE to a FALSE and a FALSE to a TRUE so conditional formatting works

    =NOT(AND(B5<>"",COUNTIF(E$5:E$22,LEFT(B5,3)&"*")>0))

    possibly
    =AND(B5="",COUNTIF(E$5:E$22,LEFT(B5,3)&"*")=0)
    May Work- Not tested though

  7. #7
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Phoenix, Az
    MS-Off Ver
    MS Office 365
    Posts
    144

    Re: Conditional Formatting - comparing numbers

    Thanks Wayne!

  8. #8
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Conditional Formatting - comparing numbers

    your welcome

    if my assistance has helped, and only if you wish to , there is a reputation icon * on the left hand side - you can add to my reputation here

+ 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. Conditional Formatting - Comparing Two Cells
    By NahRoots in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-11-2012, 08:42 PM
  2. [SOLVED] Conditional Formatting Comparing Cells Within A Row
    By barneyf in forum Excel General
    Replies: 2
    Last Post: 10-05-2012, 03:38 PM
  3. Conditional Formatting - comparing worksheets
    By HBF in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-12-2008, 12:28 PM
  4. VBA for comparing dates within conditional formatting?
    By HelenW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-10-2008, 09:33 AM
  5. Conditional Formatting-Comparing Two Columns
    By Tom K in forum Excel General
    Replies: 1
    Last Post: 05-04-2006, 01:25 PM

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