+ Reply to Thread
Results 1 to 7 of 7

Conditional formatting a pair of numbers

  1. #1
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Conditional formatting a pair of numbers

    Hi, I would like your help in formatting.
    I would like to color in a table A1: E22, the pair of numbers found in the G1-H1
    Only if both present and not just one.
    thanks

    numeri-doppi.zip

  2. #2
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Conditional formatting a pair of numbers

    Hi Berna11

    Conditional formatting: =OR(A1=15,A1=32)

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

    Re: Conditional formatting a pair of numbers

    Select all the cells from A1 to E22, click on Conditional Formatting | New Rule | Use a formula ... , and then put this formula in the formula box:

    =OR(AND(A1=$G$1,COUNTIF($A1:$E1,$H$1)>0),AND(A1=$H$1,COUNTIF($A1:$E1,$G$1)>0))

    Then click the Format button, then the Fill tab, and choose your colour. Then OK your way out, and Excel will adjust those cell references as appropriate.

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Re: Conditional formatting a pair of numbers

    Hi @ Kevin numbers can vary in G1-H1
    @ Pete your formula is not working for me one or two?
    * ... $ H $ 1)> 0) and (A1 = $ H $ 1, ...?
    Could you send me the file with the example?
    thanks

  5. #5
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Conditional formatting a pair of numbers

    Hi Berna11

    Try:

    =OR(A1=$G$1,A1=$H$1)

    Edit: Formula corrected
    Last edited by Kevin UK; 11-23-2012 at 02:22 PM. Reason: I'll get it right!

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

    Re: Conditional formatting a pair of numbers

    Quote Originally Posted by Berna11 View Post
    Could you send me the file with the example?
    File attached, as requested.

    I've been playing about with different numbers in G1/H1.

    Hope this helps.

    Pete
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    05-16-2012
    Location
    Latina, ITALY
    MS-Off Ver
    Excel 2010--2016
    Posts
    947

    Re: Conditional formatting a pair of numbers

    Hi,
    @ Kevin colors even when there is only one number and not both.
    @ Pete Ok! works perfectly
    I had forgotten to replace a (,) with ( excel Italian.
    Thanks a lot.

+ 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