+ Reply to Thread
Results 1 to 2 of 2

Compare and count the matching values from different columns

Hybrid View

  1. #1
    Registered User
    Join Date
    07-04-2012
    Location
    Coimbatore,India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Compare and count the matching values from different columns

    Hi everyone,

    I am working in a file where it consists of 4 columns of data. It contains the item number and price.We have to match the item and price from the first 2 columns with the item and price from the 3rd and 4th column. If the item matches, we have to compare the price. We have to count how many values are greater or lesser than the one listed in column 2 and display in a new column. I have given an example too.

    Raw Data
    Item1 Price1 Item1 Price2
    A 2 a 4
    B 3 a 1
    C 3 b 1
    D 1 c 3

    Result should be
    Item <Price > Price
    A 1 1
    B 1 0

    Please help me solve it for me. We are working in a huge file and we are now working for days together to consolidate it since each will will have thousands of lines in it.

    Thanks in Advance

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Compare and count the matching values from different columns

    Assuming your data is in A1:D4, and you values in A1:A4 are unique,

    Then assuming you have a unique list in G1:G4, in H1:

    =SUMPRODUCT(--($C$1:$C$4=$G1),--($D$1:$D$4<SUMIF($A$1:$A$4,$G1,$B$1:$B$4)))

    copied down

    in J1:

    =SUMPRODUCT(--($C$1:$C$4=$G1),--($D$1:$D$4>SUMIF($A$1:$A$4,$G1,$B$1:$B$4)))

    copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ 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