Forum Discussion

abrummet's avatar
abrummet
Copper Contributor
Jan 21, 2022
Solved

difference between two filtered lists in excel

Hi,

I have two lists and I want to compare between them. However, I only want to compare between certain portions of each list. What I am really looking for is the difference between 2 filter functions. In my example below, I have 2 list and I filter each one based on the criteria of being "=1". I would like to create a function that gives me the difference between these two filter functions, in this case that would be "joe". Is this possible? Thank you in advance.

 

list 1 filter list 1 list 2 filter list 2  
bob1bob bob1bob  
tom1tom tom1tom  
dave2joe sam3   
joe1       
sam3=FILTER(A2:A6,B2:B6=1)   =FILTER(F2:F6,G2:G6=1)  
         

7 Replies

    • abrummet's avatar
      abrummet
      Copper Contributor
      Additionally, I simply embedded the two initial filter functions into the filter and xlookup combo and that worked wonderfully. So this is condensed down into 1 equation. Thanks!
    • abrummet's avatar
      abrummet
      Copper Contributor

      Riny_van_Eekelen 

      Thanks. I see what you are doing there and that makes sense; however, it doesn't quite work for what I am wanting to do. The xlookup embedded in the filter function is essentially just finding the difference between the two lists with no connection to the number associated with that person.  I am trying to find the difference between the two list for everyone that has a certain number associated with them. Meaning, who is a "1" on the first list and who is a "1" on the second list, and now what is the difference between them. Any thoughts on this? Thanks again.

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        abrummet But that is exactly what the formula is doing. You asked for a formula that could determine the difference between two list, filtered for the number 1.

         

        You can cut-out the interim steps to make an "all-in-one-formula" like this:

         

        =FILTER(FILTER(B2:B6,C2:C6=1),XLOOKUP(FILTER(B2:B6,C2:C6=1),FILTER(E2:E4,F2:F4=1),FILTER(E2:E4,F2:F4=1),1)=1)

         

        Make it easier to read/maintain by using named ranges, rather than direct cell references and a hard-coded numbers 1. Since you are on a recent Excel version, consider using LET to avoid the repeating portions in the formula. But perhaps I have missed your point all-together.

         

        Edit: Didn't see your last two posts until I posted mine.

      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        Benny_1857 I guess so. The "X" inside the XLOOKUP is what get's returned when the lookup value is not found. Then, with FILTER you can specify the "X" to be the inclusion criteria.

Resources