+ Reply to Thread
Results 1 to 7 of 7

Conditional formatting to whole numbers

  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    Portland, Maine
    MS-Off Ver
    2007
    Posts
    3

    Conditional formatting to whole numbers

    I have a sheet with decimal places on it but I would like to highlight the numbers based on the whole number, ignoring the decimals. For example:

    5.3 5.2 4.5 6.3 5.5

    If 5.3 is the reference cell, I would like to format the other cells to appear red if they are not 5.X. So the 4.5 and 6.3 would appear red while the 5.2 and 5.5 would remain black.

    PS. I am an amateur so I don't know a lot of the lingo. Talk to me like I'm 10 years old :P

    Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Conditional formatting to whole numbers

    Tell us a bit more about your sheet, then. Do your numbers go across the sheet in one row, or do they go down the sheet in one column? Which cells are used? (e.g. from A2 to A20).

    Pete

  3. #3
    Registered User
    Join Date
    01-28-2015
    Location
    Portland, Maine
    MS-Off Ver
    2007
    Posts
    3

    Re: Conditional formatting to whole numbers

    The reference cells run down from P2 - P229 and I want to format each row individually to the value in P. The cells I want to format run from column Q to AV.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional formatting to whole numbers

    Select Q2:AV229
    Conditional Formatting>New Rule>Use Formula

    =INT($P2)=INT(Q2)
    or if you have blank rows
    =AND(ISNUMBER($P2), INT($P2)=INT(Q2))
    Format as you like
    Did that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Conditional formatting to whole numbers

    Okay, select (highlight) all the cells from Q2 to AV229 first, and then click on Conditional Formatting | New rule and select Use a formula ... from the bottom of the list. In the dialogue box that pops up, put this formula in the formula box:

    =INT(Q2)<>INT($P2)

    then click on the Format button in the dialogue box, choose the Font tab (as it is the foreground colour that you want to change) and click on the Color drop-down and choose red. Then click OK twice to exit the dialogue box, and Excel will automatically apply that rule to the selected cells, making appropriate adjustments to the formula.

    Hope this helps.

    Pete

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional formatting to whole numbers

    Pete got it right. I read it backwards as in you wanted to format the cells that matched.

  7. #7
    Registered User
    Join Date
    01-28-2015
    Location
    Portland, Maine
    MS-Off Ver
    2007
    Posts
    3

    Re: Conditional formatting to whole numbers

    Thanks for the help! I am caught up in something else right now so I will try it out tomorrow and let you know.

+ 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 formatting - formatting the lowest 2 numbers in a list of 12 numbers
    By ktbb0312 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-09-2013, 09:59 AM
  2. [SOLVED] Conditional Formatting for Whole Numbers
    By Majella in forum Excel General
    Replies: 15
    Last Post: 12-05-2012, 09:01 PM
  3. Replies: 9
    Last Post: 03-26-2012, 02:16 PM
  4. Conditional formatting between 2 numbers
    By Guntruck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-18-2011, 08:41 AM
  5. Conditional formatting for TWO numbers
    By peri1224 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-16-2009, 06:52 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