+ Reply to Thread
Results 1 to 6 of 6

Deleting Rows with coinciding positive and negative values

  1. #1
    Registered User
    Join Date
    11-05-2020
    Location
    Texas, USA
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    3

    Deleting Rows with coinciding positive and negative values

    Hello, new here and I apologize if I don't follow the correct etiquette, nonetheless, I wanted to know if there is a way to write a formula which can delete rows if it meets certain criteria and it has corresponding positive and negative values, for example, say we have the following three values columns


    2856467 99745 1
    2856467 99745 -1
    4556434 87452 2
    1856434 78549 7

    The formula I thought would be, =IF(A1=A2,IF(B1=B2,C1+C2,""),""), which I know is incorrect, but it was my first attempt. Essentially, what would make this better would be to have it check al four entries on column A, and then once it finds a match have it check all four entries in B, and once again when it finds a match then if the values in C coincide but are inverses of each other, i.e. one positive-one negative then these two would be deleted. If these conditions were not met we would leave them alone. Would this be something that would be possible to do? Thank you all help is greatly appreciated, as I am still a beginner in Excel.
    _____________________________________________________________________________________
    I have added a sample excel worksheet for the sample data. The concept remains the same, I would like to check column A, column B and then delete the positive and negative values in column D with their respective rows, if the criteria is met, as described above (this corresponding to the sample worksheet provided). Would this be possible using formulas and functions, if not delete perhaps identify. Or if I would have to use VBA, how and where could I get started as I have no experience with this aspect of Excel. Thank you.



    _______________________________________________________________________________________
    I have updated the sample excel workbook, so that it is more concise and in-line with my target question. Thank you

    I have also, asked this question in Mr.Excel, but it won't allow me to post the link

    https://www.mrexcel.com/board/thread...alues.1150355/ link added by Moderator
    Attached Files Attached Files
    Last edited by 6StringJazzer; 11-05-2020 at 06:49 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Deleting Rows with coinciding positive and negative values

    A formula can't delete rows - you would need VBA for that. What you can do with a formula is to identify rows which need to be deleted, and then you could manually delete them (e.g. using a filter, so that you can do this in one operation). Alternatively, you could copy just the rows which should be retained to another worksheet.

    It would help if you attached a sample Excel workbook - details of how to do this are given in the yellow banner at the top of the screen.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    11-05-2020
    Location
    Texas, USA
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    3

    Re: Deleting Rows with coinciding positive and negative values

    Thank you so much Pete for your response. I went ahead and updated my question and added a small excel worksheet with sample data to go along with my question. How would I go about identifying the rows as you suggested or if this wouldn't be possible how could I use VBA to delete them if they meet the required criteria? Where could I start as I have no experience using this aspect of Excel. I apologize if this is too much to ask and I am not following proper website etiquette. Thank you once again.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Deleting Rows with coinciding positive and negative values

    if you are saying that if you have duplicates in columns A, B, C and D and you want those removed you can highlight the area and go to the Data tab then open Remove Duplicates then it will open a window with columns A, B, C and D checked and you just hit ok and all the duplicates that occur in all four columns will be removed leaving only the ones that are not duplicated in all four columns.
    if that isn't what you want perhaps indicate in your workbook which ones you would want removed, then maybe a formula could be written that would show which - using a helper column. Otherwise, the VBA option is another area of this forum and you should message a moderator to have this post moved so someone could write the code for you.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  5. #5
    Registered User
    Join Date
    11-05-2020
    Location
    Texas, USA
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    3

    Re: Deleting Rows with coinciding positive and negative values

    I'm not quite asking to remove duplicates as I know there is duplicates, what I need is for it to check if the entries coincide, if so check the next column and see if the other criteria is met, then finally check the final column. If the values coincide, but the signs are different, i.e. one is +1 and the other is -1, with all other criteria and corresponding values coinciding, then we would delete these two rows or essentially identify them as we need to delete them.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Deleting Rows with coinciding positive and negative values

    Quote Originally Posted by lastgunslinger7 View Post
    Hello, new here and I apologize if I don't follow the correct etiquette,

    I have also, asked this question in Mr.Excel, but it won't allow me to post the link
    I have posted the link for you.

    To be sure that you follow the correct etiquette, please take two minutes to review our rules. There aren't many, and they are all important.

+ 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. Replies: 4
    Last Post: 11-01-2019, 08:48 AM
  2. [SOLVED] Deleting Correlating Positive and Negative Numbers based on Criteria
    By amaan.khowaja in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-02-2013, 06:49 AM
  3. Zeroing out Positive and Negative Values in Rows
    By Lancer234 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-28-2013, 03:07 PM
  4. Delete rows based on lower value than number specified , positive or negative values
    By LadyNicole in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 06-11-2013, 03:33 AM
  5. Deleting Correlating Positive and Negative Numbers
    By rwmccall in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-06-2013, 03:12 AM
  6. Convert negative to positive in sheet containing both positive/negative numbers
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2010, 07:52 PM
  7. Replies: 4
    Last Post: 09-26-2005, 06:05 PM

Tags for this Thread

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