Forum Discussion

jordan1213's avatar
jordan1213
Copper Contributor
Nov 29, 2023

Pulling exact same data across multiples tables

I've looked around and could not find an answer.

Example i have 4 sets of tables like this

 

table 1                                                                            table 2

12010040 11030050
12510050 21210035
13015070 24027590
23325040 

3

 

3012545
24027590 32714550
250300100 31023575
36010070 46015535
46515050 47017540
         
         
table 3    table 4   
11010035 1510030
21512545 1612540
23320060 21015020
24027590 24027590
34712545 32710060
36017565 33915070
46515020 34517580
48020030 35030090

 

I need a function that can find the matching rows and populate all of them

so 

24027590

 

or any others because each table will have about 8000 rows of data each

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    Hi jordan1213 

    If by any chance one of the proposals you got solves the issue it would be smart of you to click on Mark as solution (at the bottom of the corresponding post) to help those who Search (as you looked around)

     

    Thanks

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    Hi jordan1213 

     

    Alternatively with 8k rows/table I would do it by merging tables (Inner Join) with Power Query (many videos exist on the Net)

    Given you only have 4 tables you can easily do this with almost no knowledge of PQ, repeating the merges one after the other (3 merges in total). Alternatively the attached workbook does it by iterating the list of tables to merge (added an add. dummy record - 96...99 - that matches):

     

  • jordan1213 

    =AND(COUNTIFS($F$3:$F$10,A3,$G$3:$G$10,B3,$H$3:$H$10,C3,$I$3:$I$10,D3)>0,
    COUNTIFS($A$14:$A$21,A3,$B$14:$B$21,B3,$C$14:$C$21,C3,$D$14:$D$21,D3)>0,
    COUNTIFS($F$14:$F$21,A3,$G$14:$G$21,B3,$H$14:$H$21,C3,$I$14:$I$21,D3)>0)

     

    You can apply AND along with COUNTIFS. The formula returns TRUE (WAHR in german Excel) for the rows of data which occur in all 4 tables. The ranges within COUNTIFS can be adapted as required.

     

    =FILTER(A3:D10,E3:E10)

     

    If you have access to the FILTER function you can apply it to select only the rows that occur in all 4 tables.

     

    =IFERROR(INDEX(A$3:A$10,SMALL(IF($E$3:$E$10=TRUE,ROW($A$3:$A$10)-2),ROW($A1))),"")

     

    If you don't have access to the FILTER function you can use this formula to select only the rows that occur in all 4 tables. The formula is in cell K7 and filled across range K7:N10. The formula must be entered with ctrl+shift+enter if someone doesn't work with Office 365 or Excel for the web or Excel 2021.

Resources