+ Reply to Thread
Results 1 to 7 of 7

Remove lines based on multiple criteria

  1. #1
    Registered User
    Join Date
    12-22-2015
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    13

    Remove lines based on multiple criteria

    I am trying to eliminate certain rows in my workbook automatically based on a few fields. The file contains patient encounters with hospitals. Patient can either be discharged from the ED, admitted to inpatient, or discharged from inpatient. If a patient is transferred to inpatient from the ED, it actually comes up in the workbook as an ED Discharge and an Inpatient Admit as two separate rows with the same date. I would like to remove both rows when:

    - Patient name is the same
    - Date is the same
    - Encounter type is ED Discharge and Inpatient Admit

    I've attached a sample workbook to illustrate the desired outcome.
    Attached Files Attached Files
    Last edited by cmray58; 11-08-2018 at 03:26 PM.

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Remove lines based on multiple criteria

    Try

    Please Login or Register  to view this content.
    Kind regards
    Leo

  3. #3
    Registered User
    Join Date
    12-22-2015
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    13

    Re: Remove lines based on multiple criteria

    Hi LeoTaxi,

    Thanks for putting this together. However, it looks like it's only deleting one of the entries instead of both.

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Remove lines based on multiple criteria

    If i test on the file you posted, it deletes both

    kind regards
    Leo

  5. #5
    Registered User
    Join Date
    12-22-2015
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    13

    Re: Remove lines based on multiple criteria

    It's still only removing one for me...maybe I'm doing this wrong?

    I've been going into Developer tab > Visual Basic > Inset > Module > Copy/paste code > Select all of the code and run

    I'm still seeing John Smith Inpatient Admit 1/1/2018

  6. #6
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Remove lines based on multiple criteria

    Here file where it is working

    Cheers
    Leo
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-22-2015
    Location
    NY
    MS-Off Ver
    Office 365
    Posts
    13

    Re: Remove lines based on multiple criteria

    "Subscript out of range"

    Capture.JPG

+ 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. [SOLVED] Sum Multiple Lines based on Multiple Criteria
    By Netsirkf in forum Excel General
    Replies: 5
    Last Post: 10-29-2018, 05:49 AM
  2. [SOLVED] Grab lines of data from sheet based on multiple criteria (working slightly)
    By kai. in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-30-2018, 04:43 AM
  3. [SOLVED] Remove lines based on cell value (remove lines in range, not entire row)
    By Tapyr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-27-2015, 07:31 AM
  4. Remove duplicates based on multiple criteria
    By cbwilliams in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-18-2015, 05:12 PM
  5. [SOLVED] Find matching lines based on multiple criteria
    By Jonathan68 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-13-2014, 06:04 PM
  6. [SOLVED] Remove multiple rows based on multiple cell's criteria
    By wyanrandy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2012, 04:28 PM
  7. Create multiple lines based upon criteria
    By SystemsAccountant in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-05-2008, 01:14 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