Results 1 to 7 of 7
  1. #1
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts

    Macro to delete rows where values are the same

    I would like a macro to delete the rows where the value in Col F equals the Value in Col G .One can have a situation where two or three items added up in Col F equals the value in G. I have highlighted the items where the values are the same and the rows needs to be deleted

    Your assistance in this regard is most appreciated
    Attached Files Attached Files

  2. #2
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,819
    Thanks
    133
    Thanked 480 Times in 457 Posts
    Hi Howard

    In your example file, why aren't rows 1 and 2 included, since they are the same value????

    zeddy

  3. #3
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi Zeddy

    My apologies. Rows 1 & 2 should have been included

    Howard

  4. #4
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,819
    Thanks
    133
    Thanked 480 Times in 457 Posts
    Hi Howard

    Apologies for delay in replying. I've been away again.
    I see you have had no further responses on this request.

    A partial solution to your request would be to enter the following formula into cell [H1] on your example sheet:
    =IF(SUMIF(E:E,E1,F:F)-SUMIF(E:E,E1,G:G)=0,"delete","")
    ..and then copy this formula down (to row 22 in your example file).

    If the total for any given Purchase Order amount matches the total Workshop amount for the same Purchase Order number, then the formula will give a result of delete for that row.

    In your example file, the total amount for Purchase Order 41452 does not match the total Workshop amount for this PO number, so that PO number is left i.e. does not show delete, even though there are a pair of items within this PO number that do match.

    Do you want a more complex solution to deal with this case???

    zeddy

  5. #5
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi Zeddy

    Thanks for the reply. The last part regarding the purchase order is no longer applicable so your solution will do the job

    Howard

  6. #6
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,819
    Thanks
    133
    Thanked 480 Times in 457 Posts
    Hi Howard

    ..just to be clear, the record rows that are marked for 'delete' must be deleted 'together' i.e. all in one go.
    If you delete a single record row marked for delete, the formulas will update and other corresponding records will now be 'out of balance'.

    zeddy

  7. #7
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi Zeddy

    Thanks for the tip

    Howard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •