+ Reply to Thread
Results 1 to 23 of 23

How to delete those rows which has same positive & negative value

  1. #1
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Smile How to delete those rows which has same positive & negative value

    Hi All,

    Forgive me if i am not in the correct forum.

    I am new in excel. Need urgent help in excel, as i am stuck with something for so long.

    My problem :
    " I am taking huge data file. and i need to take two columns in consideration ColumnA(name) and ColumnB(hours). ColumnB presents the hours spend by users on activities, Sometime it is like this :
    Anish -> +40
    Anish -> -40
    Sneha -> +50
    Sneha -> -50
    Raghu -> 45
    Pradip -> 23

    what i need to do it is.. delete those rows which has same user's name and same hours(+40, -40) as the sum is zero, so we dont need these names to show in report.
    for example - I need to delete Row1,2,3 &4 in above given sample.
    What I am expecting is, Is there any way I can highlight these rows then rest of the things will be easier to me.

    Kindly provide your earliest help.
    Thanks
    JoyHarry
    Last edited by joyharry; 05-21-2013 at 04:11 AM.

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Need Urgent Help!!

    Hi JoyHarry,

    welcome to the forum.
    Please change the thread title to reflect the query you are asking :-

    http://www.excelforum.com/forum-rule...rum-rules.html



    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Urgent Help!!

    @dili

    thanks for directing me to this link.

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: How to delete those rows which has same positive & negative value

    Hi Joyharry,

    see the attached file where I used below formula to obtain desired results:-
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Now filter column C for 1 and that is your required data

    del dup sets.xlsx

    Regards,
    DILIPandey
    <click on below * if this helps>

  5. #5
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    Hi
    Thanks 4 ur solution.

    This solution is working, but it is not working correctly for huge data. When i apply this formula, I got multiple of numbers 0,1,2,3,4,10,12 like this.

    Can you tell what could be the reason?

  6. #6
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: How to delete those rows which has same positive & negative value

    Now filter column C for 1 and that is your required data
    Is that not solving your problem ?
    If yes, then upload your data .. thanks.

    Regards,
    DILIPandey
    <click on below * if this helps>

  7. #7
    Registered User
    Join Date
    05-22-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    13

    Post Re: How to delete those rows which has same positive & negative value

    Dear Friend,

    1st go next column and take formula =abs(b column) pull down the formula until your data end.

    Then select the whole your data with extra row of Abs and move your scroll up and click data find the remove duplicate and select A & C Column.

    Take Care

    Regards,

    Abdul Basit
    Attached Images Attached Images

  8. #8
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    yes, its not working.

    Actually I want to delete those rows where the sum is zero because of same positive & negative numbers. and in my data file, There are many duplicate names in column A and dats y it is not giving expected result.

    test.xlsx

  9. #9
    Registered User
    Join Date
    05-22-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to delete those rows which has same positive & negative value

    Dear Bro,

    The simple formula abs used now check the screenshot.
    Attached Images Attached Images
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    Abdul,

    I think you misunderstood my query.I want to delete those rows which has same name in columnA & same positive & negative numbers in ColumnB.

    I want this to happen because the sum of hours will be zero for these names.

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: How to delete those rows which has same positive & negative value

    If you would want to try code, you could try this on a copy of your workbook.
    Names are in Column A (starting at A1) and hours are in column B

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    05-22-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to delete those rows which has same positive & negative value

    Dear Bro ,

    Check the file the fourth column "check it" . and filter the numbers except zero..

    May be this file can help you..
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to delete those rows which has same positive & negative value

    Try the attached
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    @Jindon,

    This is working. Can you plz explain the code as I am new to VBA. Little explanation will be very helpful.

    thanks very much

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to delete those rows which has same positive & negative value

    Actually the code should be like this in case of multiple exact same amount....
    Please Login or Register  to view this content.
    1) Main dictionary store its child dictionary for each emppyee.
    2) each child dictionary stores absolute amount of hours as its key and set the reference to that cell for its item property.
    3) when duplicates find and the balance is 0 then set variable x ( as range) to those cells.
    4) delete x when x is not nothing.

    Helps?

  16. #16
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: How to delete those rows which has same positive & negative value

    Maybe this formula in C2, Drag/Fill Down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Filter C2 for "Delete", then delete the resulting rows.
    Remove the filter and clear Column C
    Attached Files Attached Files
    Last edited by Marcol; 05-23-2013 at 06:50 AM. Reason: Typos
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  17. #17
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: How to delete those rows which has same positive & negative value

    Alternative code. Its workings should be reasonably intuitive.
    Deletes matching + and - for first two columns only, but easily modified to do entire row if that's wanted.
    Please Login or Register  to view this content.
    Last edited by kalak; 05-23-2013 at 06:50 AM.

  18. #18
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    Hi guys,

    these codes are working fine. but when i am trying to run these on codes on my original file it is giving me some wrong picture. I think I am making some mistake.
    I am attaching my original file. Please attach code to that file.

    check.XLS

    I will really appreciate your kind efforts.

    thanks
    Joy!

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to delete those rows which has same positive & negative value

    Replace All r(, 2) With r(, 10) in my code

  20. #20
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    I replaced r(, 2) with r(, 10) but still it was giving me wrong picture. but now it worked!!! I was making a small and silly mistake.

    Thank you guys & community for your earliest help. I was new in this community but the way you all provided your help, I truly appreciate that!!

    Thank you very much!!
    Joy

  21. #21
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    Hi,

    I have 1 more question regarding this code.
    What if i want to remove these rows with two criteria? Like, earlier I wanted those rows to be deleted which has same empl name & same positive & negative numbers(hours).

    And now if I want those rows to be deleted which has same name, same positive & negative number(hours) and those hours are of same month. for example you can see attached file.

    check.XLS

  22. #22
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: How to delete those rows which has same positive & negative value

    You have 2 date columns and I don't know which one you are talking about, so I will leave this to the others.

  23. #23
    Registered User
    Join Date
    05-21-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: How to delete those rows which has same positive & negative value

    I am talking about Column I(empl name), J(hours) & O(Claim_month)

+ 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