+ Reply to Thread
Results 1 to 3 of 3

Match columns, sort and add gaps in row/s if required

  1. #1
    Registered User
    Join Date
    08-17-2010
    Location
    Jena, Germany
    MS-Off Ver
    Excel 2007
    Posts
    6

    Match columns, sort and add gaps in row/s if required

    Hi all

    Title of the post and the following image describes the data that I have and how want it to be rearranged. I have tried MATCH function but it helps only in sorting, not adding a row gap in any column if the other column has an extra entry. Can anyone advise any solution?

    Thanks
    Ram

    bfm5w3.jpg

  2. #2
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2010 32-Bit
    Posts
    276

    Re: Match columns, sort and add gaps in row/s if required

    working off the assumption that watermelon < Strawberry is a typo...

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    1
    Input
    2
    List A List B A Only B Only A Both B Both A More A B More B FirstRow A FirstRow B
    3
    Apple Banana TRUE FALSE FALSE TRUE FALSE FALSE 0 1
    4
    Banana custard apple FALSE TRUE TRUE FALSE TRUE FALSE 1 3
    5
    Banana Mango FALSE FALSE TRUE TRUE TRUE TRUE 1 4
    6
    Mango Mango FALSE FALSE TRUE TRUE FALSE TRUE 4 4
    7
    watermelon Strawberry TRUE FALSE FALSE TRUE FALSE TRUE 7 6
    8
    Strawberry FALSE FALSE TRUE FALSE FALSE FALSE 6 0

    Cell Formulas

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    1
    Input
    2
    List A List B A Only B Only A Both B Both A More A B More B FirstRow A FirstRow B
    3
    Apple Banana =AND(NOT(ISBLANK(A3)),COUNTIF($B$3:$B$8,A3)=0) =AND(NOT(ISBLANK(B3)),COUNTIF($A$3:$A$8,B3)=0) =AND(NOT(D3),NOT(ISBLANK(A3))) =AND(NOT(E3),NOT(ISBLANK(B3))) =AND(F3,COUNTIF($A$3:$A$8,A3)>COUNTIF($B$3:$B$8,A3)) =AND(G3,COUNTIF($A$3:$A$8,B3)<=COUNTIF($B$3:$B$8,B3)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<A3)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<A3)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<B3)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<B3))
    4
    Banana custard apple =AND(NOT(ISBLANK(A4)),COUNTIF($B$3:$B$8,A4)=0) =AND(NOT(ISBLANK(B4)),COUNTIF($A$3:$A$8,B4)=0) =AND(NOT(D4),NOT(ISBLANK(A4))) =AND(NOT(E4),NOT(ISBLANK(B4))) =AND(F4,COUNTIF($A$3:$A$8,A4)>COUNTIF($B$3:$B$8,A4)) =AND(G4,COUNTIF($A$3:$A$8,B4)<=COUNTIF($B$3:$B$8,B4)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<A4)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<A4)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<B4)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<B4))
    5
    Banana Mango =AND(NOT(ISBLANK(A5)),COUNTIF($B$3:$B$8,A5)=0) =AND(NOT(ISBLANK(B5)),COUNTIF($A$3:$A$8,B5)=0) =AND(NOT(D5),NOT(ISBLANK(A5))) =AND(NOT(E5),NOT(ISBLANK(B5))) =AND(F5,COUNTIF($A$3:$A$8,A5)>COUNTIF($B$3:$B$8,A5)) =AND(G5,COUNTIF($A$3:$A$8,B5)<=COUNTIF($B$3:$B$8,B5)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<A5)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<A5)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<B5)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<B5))
    6
    Mango Mango =AND(NOT(ISBLANK(A6)),COUNTIF($B$3:$B$8,A6)=0) =AND(NOT(ISBLANK(B6)),COUNTIF($A$3:$A$8,B6)=0) =AND(NOT(D6),NOT(ISBLANK(A6))) =AND(NOT(E6),NOT(ISBLANK(B6))) =AND(F6,COUNTIF($A$3:$A$8,A6)>COUNTIF($B$3:$B$8,A6)) =AND(G6,COUNTIF($A$3:$A$8,B6)<=COUNTIF($B$3:$B$8,B6)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<A6)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<A6)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<B6)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<B6))
    7
    watermelon Strawberry =AND(NOT(ISBLANK(A7)),COUNTIF($B$3:$B$8,A7)=0) =AND(NOT(ISBLANK(B7)),COUNTIF($A$3:$A$8,B7)=0) =AND(NOT(D7),NOT(ISBLANK(A7))) =AND(NOT(E7),NOT(ISBLANK(B7))) =AND(F7,COUNTIF($A$3:$A$8,A7)>COUNTIF($B$3:$B$8,A7)) =AND(G7,COUNTIF($A$3:$A$8,B7)<=COUNTIF($B$3:$B$8,B7)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<A7)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<A7)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<B7)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<B7))
    8
    Strawberry =AND(NOT(ISBLANK(A8)),COUNTIF($B$3:$B$8,A8)=0) =AND(NOT(ISBLANK(B8)),COUNTIF($A$3:$A$8,B8)=0) =AND(NOT(D8),NOT(ISBLANK(A8))) =AND(NOT(E8),NOT(ISBLANK(B8))) =AND(F8,COUNTIF($A$3:$A$8,A8)>COUNTIF($B$3:$B$8,A8)) =AND(G8,COUNTIF($A$3:$A$8,B8)<=COUNTIF($B$3:$B$8,B8)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<A8)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<A8)) =SUMPRODUCT(($D$3:$D$8+$H$3:$H$8)*($A$3:$A$8<B8)+($E$3:$E$8+$I$3:$I$8)*($B$3:$B$8<B8))
    If it'd make you feel better using my answer because of my street cred, then you can go ahead and click Add Reputation below to improve it.

  3. #3
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2010 32-Bit
    Posts
    276

    Re: Match columns, sort and add gaps in row/s if required

    of course this would be a whole lot easier with VBA

    Please Login or Register  to view this content.
    Last edited by Gregor y; 01-23-2018 at 12:17 AM.

+ 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. i need to sort three columns of data so the numbers match all columns where found
    By lisagonzalez in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-24-2015, 03:10 PM
  2. match and sort by two columns
    By yowzerz in forum Excel General
    Replies: 21
    Last Post: 07-23-2013, 06:54 PM
  3. Replies: 1
    Last Post: 11-06-2012, 07:07 PM
  4. [SOLVED] Sort the numbers with gaps where there is no continuation
    By sureshgps in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-06-2012, 12:22 AM
  5. Replies: 0
    Last Post: 07-07-2011, 05:04 PM
  6. Replies: 3
    Last Post: 02-27-2009, 10:56 AM
  7. Replies: 9
    Last Post: 07-02-2008, 06:16 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