+ Reply to Thread
Results 1 to 10 of 10

Match Negative number with its corresponding positive number after matching columns

  1. #1
    Registered User
    Join Date
    10-21-2015
    Location
    San Diego
    MS-Off Ver
    MS Office 2013
    Posts
    7

    Match Negative number with its corresponding positive number after matching columns

    Hi,
    I am looking to see if there is a way to highlight a negative number with its corresponding positive based on the information on the other columns. Here is an example:
    Col 1 Col 2 Col 3
    Apple Orange -1
    Apple Orange 1
    Apple Banana 1

    So I want excel to compare column 1 and 2 and then highlight row 1 and 2 since there is a negative and corresponding positive number on there. I dont want excel to highlight it if the numbers dont match even if column 1 and 2 have an exact match. Does that make sense?

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Match Negative number with its corresponding positive number after matching columns

    Select your range first in current case A1 to C3 then click conditional formatting
    click new rule -----> click use a formula to determine which cell to format
    in formula box copy paste below
    =SUMPRODUCT((($A$1:$A$3=$A1)*($B$1:$B$3=$B1)*(ABS($C$1:$C$3)=ABS($C1))))>1
    then click format select colour as desired by you

    hit Ok
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Registered User
    Join Date
    06-22-2015
    Location
    Hilversum, Netherlands
    MS-Off Ver
    2007
    Posts
    12

    Re: Match Negative number with its corresponding positive number after matching columns

    Hi Asharma9,

    You can try to use this formula to conditionally format the cells:
    =SUMPRODUCT(($A$1:$A3=$A1)*($B$1:$B3=$B1)*(($C$1:$C3=$C1)+($C$1:$C3=-$C1)))>1

    Best regards,
    Maarten

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Match Negative number with its corresponding positive number after matching columns

    Or

    try in conditional formating

    =SUMPRODUCT(--($A1&$B1&ABS($C1)=$A$1:$A$3&$B$1:$B$3&ABS($C$1:$C$3)))>1
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  5. #5
    Registered User
    Join Date
    10-21-2015
    Location
    San Diego
    MS-Off Ver
    MS Office 2013
    Posts
    7

    Re: Match Negative number with its corresponding positive number after matching columns

    Hi All,
    Thank you so much for your great suggestions. I am not exactly getting the right output yet. The other thing I want to achieve is that if there are multiple of the same combinations then I want to select only one combination of the negative and positive value.
    Here is the Example again, I added another row of apple and orange with +1. I want to select only ONE combination of apple, orange -1 and apple, orange, +1. I want it to ignore the last one. Is that possible?

    Col 1 Col 2 Col 3
    Apple Orange -1
    Apple Orange 1
    Apple Banana 1
    Apple orange 1

    Thanks!
    Amar

  6. #6
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Match Negative number with its corresponding positive number after matching columns

    Ok

    Try in conditional formatting below formula

    =SUMPRODUCT(--($A2&$B2&$C2=$A$2:A2&$B$2:B2&$C$2:C2))<=SUMPRODUCT(--($A2&$B2&-$C2=$A$2:$A$6&$B$2:$B$6&$C$2:$C$6))
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-21-2015
    Location
    San Diego
    MS-Off Ver
    MS Office 2013
    Posts
    7

    Re: Match Negative number with its corresponding positive number after matching columns

    It works like a CHARM Ankur! Thank you so much for your help! You are a genius man!

  8. #8
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Match Negative number with its corresponding positive number after matching columns

    @ Amar ! can you have data like
    Apple Orange -1
    Apple Orange 1
    Apple Banana 1
    Apple orange 1
    Apple orange -1

  9. #9
    Registered User
    Join Date
    10-21-2015
    Location
    San Diego
    MS-Off Ver
    MS Office 2013
    Posts
    7

    Re: Match Negative number with its corresponding positive number after matching columns

    Yes, my data was like that except it wasnt apple and Banana But were medications which were taken out and then returned back to the machine which created a positive and negative value.

  10. #10
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Match Negative number with its corresponding positive number after matching columns

    Glad to help you dear and thanks for feedback & rep !!!

+ 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. How to extract matching negative and positive value that match across several columns
    By daisyhill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2014, 05:47 PM
  2. Carrying Over Negative number to next column as a positive number
    By Redraven in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-21-2014, 06:39 AM
  3. Replies: 3
    Last Post: 01-03-2014, 10:20 AM
  4. [SOLVED] First Instance of a Negative and Positive Number in Adjacent Columns
    By 10OAKS in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-19-2013, 11:08 AM
  5. Move Negative Number and Change to a Positive Number
    By Alvin Hunter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2013, 08:36 PM
  6. Replies: 2
    Last Post: 11-13-2008, 12:35 AM
  7. Change a positive number to negative number
    By patowens in forum Excel General
    Replies: 4
    Last Post: 06-23-2005, 03:05 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