matching rows in complex data set

%3CLINGO-SUB%20id%3D%22lingo-sub-2461218%22%20slang%3D%22en-US%22%3Ematching%20rows%20in%20complex%20data%20set%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2461218%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20some%20large%20data%20sets%20that%20i%20need%20to%20query%20to%20isolate%20specific%20data%20rows.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEach%20row%20is%20identified%20by%20a%20date-based%20designation%2C%20with%20many%20columns%20of%20data%20following%20the%20date.%3C%2FP%3E%3CP%3EThere%20may%20be%203000-5000%20rows%20in%20each%20data%20set.%3C%2FP%3E%3CP%3EFrom%20a%20companion%20data%20set%2C%20I've%20identified%20...say...%20500%20rows%20that%20I%20want%20to%20isolate%20in%20the%20original%20data%20set%20so%20I%20can%20examine%20those%20rows%20in%20more%20detail.%26nbsp%3B%20%26nbsp%3B%20As%20an%20example%2C%20for%20the%20rows%20listed%20below%2C%20I've%20determined%20that%20I%20want%20to%20pull%20out%3C%2FP%3E%3CP%3Ethe%20rows%20ending%20in%200102%2C%26nbsp%3B%200301%2C%20and%200305.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20do%20this%20manually%2C%20spending%20a%20heck%20of%20a%20lot%20of%20time%20on%20each%20search.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20hoping%20that%20someone%20can%20suggest%20a%20better%20way%20to%20do%20this....%20i.e.%20use%20the%20list%20of%20500%20sample%20numbers%20to%20isolate%20the%20rows%20out%20of%20a%20table%20with%205000%20rows.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3CTABLE%20width%3D%2299%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2299%22%3EIRM2014010101%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010102%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010103%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010104%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010201%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010202%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010301%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010302%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010303%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010304%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3EIRM2014010305%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2461218%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2461452%22%20slang%3D%22en-US%22%3ERe%3A%20matching%20rows%20in%20complex%20data%20set%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2461452%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1081949%22%20target%3D%22_blank%22%3E%40FishDoc%3C%2FA%3E%26nbsp%3BA%20quick%20formula%20based%20solution%20would%20be%20to%20add%20a%20column%20that%20extracts%20the%20four%20rightmost%20characters%20from%20the%20IRM%20code%20and%20then%20finds%20a%20match%20in%20the%20list%20of%20selected%20codes.%3C%2FP%3E%3CP%3Efinally%2C%20filter%20all%20the%20row%20with%20TRUE.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExample%20attached.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20a%20more%20solid%20solution%20would%2C%20in%20my%20opinion%20be%20to%20use%20Power%20Query%2C%20where%20you%20connect%20to%20both%20data%20sets%20and%20merge%20(%22attache%22)%20data%20from%20the%20full%20set%20to%20the%20codes%20in%20the%20companion%20set.%20It%20would%20create%20a%20new%20data%20set%20without%20the%20need%20to%20create%20formulae%20and%20manually%20filter%20out%20the%20relevant%20rows.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I have some large data sets that i need to query to isolate specific data rows.

 

Each row is identified by a date-based designation, with many columns of data following the date.

There may be 3000-5000 rows in each data set.

From a companion data set, I've identified ...say... 500 rows that I want to isolate in the original data set so I can examine those rows in more detail.    As an example, for the rows listed below, I've determined that I want to pull out

the rows ending in 0102,  0301, and 0305.

 

I can do this manually, spending a heck of a lot of time on each search.

 

I'm hoping that someone can suggest a better way to do this.... i.e. use the list of 500 sample numbers to isolate the rows out of a table with 5000 rows.

 

Thanks!

IRM2014010101
IRM2014010102
IRM2014010103
IRM2014010104
IRM2014010201
IRM2014010202
IRM2014010301
IRM2014010302
IRM2014010303
IRM2014010304
IRM2014010305
9 Replies

@FishDoc A quick formula based solution would be to add a column that extracts the four rightmost characters from the IRM code and then finds a match in the list of selected codes.

finally, filter all the row with TRUE.

 

Example attached.

 

Now, a more solid solution would, in my opinion be to use Power Query, where you connect to both data sets and merge ("attach") data from the full set to the codes in the companion set. It would create a new data set without the need to create formulae and manually filter out the relevant rows.

Thanks Riny!

I got lost working thru the Power Query approach....

The Match and filter approach seems simpler, but have a question about what function to use for identifying the match?

@FishDoc The formula in my example is in column A.

 

=ISNUMBER(MATCH(RIGHT(B2,4),selected,0))

 

where "selected" is a named range. So, what's your question?

OK, I copied column B from your example into a new spreadsheet, including the "selected" values in a labeled block at the bottom of the column. The formula was placed in the appropriate spot in column A. Whether I used the word "selected" as in your formula, or replaced it with the fixed Block range ($B$21:$B$23), I got a response of FALSE for all pairings......

Any clue what I'm doing wrong?

Thanks!

@FishDoc Please upload the file. Then I can have a look.

@Riny_van_Eekelen 

 

Good morning!

 

I very much appreciate your assistance, and your willingness to train me in some of the finer points of Excel.

Attached is the file of my 2017 data (I have similar files for 23 years).

 

Column A are the sample numbers for data on fish collected by a particular type of net (a 180 m seine).  Column E are the sample numbers for habitat data collected as the field crew sampled fishes using many different types of nets (this matrix actually required me to do a lot of processing to reduce/reformat the data into the the simple list contained in this file).  Since the fish we're working with were effectively caught only with the 180 m seine net, I need to extract the habitat data associated only with those sample numbers (Column A).

 

I've been doing this by brute force....  Shifting values in Column A downward to match the same values in Column E, then sorting the whole matrix on Column A and discarding rows that don't match A and E.  It's a slow and painful process, and I hadn't had much luck in trying to find a way to automate the matching process.

 

Your guidance is much appreciated!

 

Jon

@FishDoc 

You may add helper column to select data which match column A as

image.png

If you are on Excel 365 now formula could be

=COUNTIF(A4:A226, E4:E827)

otherwise

=COUNTIF($A$4:$A$226,E4)

and drag it down. Apply filter to this column and unselect zero. Better to have data from column A in separate sheet.

@FishDoc You real data is slightly different than your original example where you suggested to look at the last four numbers in the Habitat Reference. But now you seem to look for the entire IRM-code.

 

In the attached file, I moved the shorter Reference list to a separate sheet and gave it a name "reference" used in the MATCH formula. Then I also put the headers in one row (you had "Habitat" and "Reference" is two separate cells). Finally, I put a filter on the longer list, so now you can select only TRUE in column A.

 

 

Hi @FishDoc ,

 

I used power query on your sample file:

 

Step 1:

Made your exclusion list into an excel table, and did a power query on it:

Yea_So_0-1624212040447.png

Yea_So_1-1624212134631.png

 

Step 2:

Defined the Dataset into an excel table, and did a power query on it:

Yea_So_2-1624212205305.png

 

Yea_So_3-1624212229865.png

Step 3:

Did a Merge Query:

When you get to this dialog box I selected the Exclusion list as the Left (top)

and selected the Dataset as the right (bottom), then selected the Anti-Right Join,

meaning only show the rows in the Right table that does not match the Left table.

Yea_So_4-1624212394355.png

The result:

Yea_So_5-1624212534290.png

 

File is attached.

 

Cheers