1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Delete row if the fruit has 1 and 0

Discussion in 'Ask an Excel Question' started by Tedishere, Jun 19, 2017.

  1. Tedishere

    Tedishere New Member

    Messages:
    4
    I have the following excel content:

    Fruit In/Out
    Apple 1
    Orange 1
    Watermelon 1
    Banana 1
    Apple 0
    Orange 0
    Peach 1
    Apple 1

    I want the final result to look like:

    Fruit In/Out
    Watermelon 1
    Banana 1
    Peach 1
    Apple 1

    What I want is to delete every fruit that has been "In" as well as been "Out". For ex: Apple has been In (1) and Out (0), and it has been In again, but don't delete that because it hasn't been Out.

    I am not sure how to approach a problem like this.
  2. NARAYANK991

    NARAYANK991 Excel Ninja

    Messages:
    15,625
    Hi ,

    If you want rows to be deleted , only VBA will do the job.

    If you want data to be extracted to a new sheet , even formulae can be used.

    Either way , please upload your workbook with adequate data in it.

    Narayan
  3. Tedishere

    Tedishere New Member

    Messages:
    4

    Attached Files:

  4. bosco_yip

    bosco_yip Well-Known Member

    Messages:
    1,248
    upload_2017-6-22_23-43-27.png

    Formula way to extract "IN" data.

    1] In helper C2, formula copy down :

    =IF(COUNTIF(A$1:A1,A2)>0,"",IF(SUMPRODUCT(($A$2:$A$9=A2)*SUBSTITUTE(B$2:B$9,"0","-1"))=1,MAX(C$1:C1)+1,""))

    2] In "Output" E2, formula copy down :

    =IFERROR(INDEX($A$2:$A$9,MATCH(ROWS($1:1),$C$2:$C$9,0)),"")

    3] In "Output" F2, formula copy down :

    =IF(E2="","",1)

    Regards
    Bosco

    Attached Files:

    Thomas Kuriakose likes this.
  5. Tedishere

    Tedishere New Member

    Messages:
    4
    Wow! Thanks a lot.

Share This Page