+ Reply to Thread
Results 1 to 5 of 5

Match positive and negative values with the same assignment/reference

Hybrid View

  1. #1
    Registered User
    Join Date
    09-10-2012
    Location
    Lund
    MS-Off Ver
    Excel 2003
    Posts
    9

    Match positive and negative values with the same assignment/reference

    Hi all,

    I want to match (highlight cells) positive and negative values per assignment. So in column A you have the assignment (ex. 1, 2, 3, 4 and 5), and in column B you have the values. So if the rows have the same assignment and have the values -5000 and 5000 they should get highlighted. But I cannot figure out any way to make this work properly with conditional formatting. But if there are two rows with the same assignment with the values of -5000 and 4000 they should not be highlighted. I have attached an example.
    example.xlsx

    Many thanks for your help, I hope this problem is possible to solve!

    Best Regards,
    Nicklas
    Last edited by nicklasj; 09-10-2012 at 03:18 PM. Reason: Solved

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Match positive and negative values with the same assignment/reference

    In C2 enter the formula with Ctrl + Shift + Enter =SUM(IF($A$2:$A$11&ABS($B$2:$B$11)=A2&ABS(B2),1,0))

    Then highlight your table A2:B11, select conditional formatting custom formula, and enter =$C2 = 2

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Match positive and negative values with the same assignment/reference

    In C2 enter the formula with Ctrl + Shift + Enter =SUM(IF($A$2:$A$11&ABS($B$2:$B$11)=A2&ABS(B2),1,0))

    Then highlight your table A2:B11, select conditional formatting custom formula, and enter =$C2 = 2
    Attached Files Attached Files

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

    Re: Match positive and negative values with the same assignment/reference

    You can use this conditional formatting formula
    Formula: copy to clipboard
    =SUMPRODUCT(--($A$2:$A$11=$A2),-- ($B$2:$B$11=-$B2))
    Does that work for you? See attachment
    Attached Files Attached Files
    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
    Registered User
    Join Date
    09-10-2012
    Location
    Lund
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Match positive and negative values with the same assignment/reference

    Thank you very much guys! You really saved my day!

+ 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