Forum Discussion

tmehringer01's avatar
tmehringer01
Copper Contributor
Jan 19, 2024
Solved

Formula Help needed for Comparing Two Arrays in Excel 365

I'm having trouble finding the right formula in Excel 365 to compare a column in an dynamic Table array with a separate dynamic list and having the formula output a variable list of items from a different column in the array.

 

Document#Criteria Criteria List Expected Output
Doc1Criteria1 Criteria3 Doc3
Doc2Criteria2 Criteria7 Doc12
Doc3Criteria3 Criteria1 Doc18
Doc4Criteria4   Doc7
Doc5Criteria5   Doc1
Doc6Criteria6   Doc10
Doc7Criteria7   Doc16
Doc8Criteria8    
Doc9Criteria9    
Doc10Criteria1    
Doc11Criteria2    
Doc12Criteria3    
Doc13Criteria2    
Doc14Criteria3    
Doc15Criteria4    
Doc16Criteria1    
Doc17Criteria2    
Doc18Criteria3    
Doc19Criteria9    
Doc20Criteria8    

 

The Document# list is unique, but there can be multiple documents with the same criteria.  The Expected Output does not need to be in any specific ordering.

 

The Expected Output is a list of all the documents from the Document# column that match the criteria in the Criteria List.

 

I've tried a variety of INDEX, SMALL, ROW functions but can't seem to get close.  Any help would be greatly appreciated.

 

Thanks in advance!

  • Harun24HR Works like a charm!  There are some advanced functions in there that I'm going to need to dig into to understand.  Looks like the formula even caught one output that I missed.

     

    Looks like they need to pay you more!  Thanks again for your help!

6 Replies

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    tmehringer01 

     

    One alternative with 365:

    =TEXTSPLIT(
      TEXTJOIN(";",,
        MAP(CriteriaList,
          LAMBDA(crit, TEXTJOIN(";",,FILTER(Table1[Document'#], Table1[Criteria]=crit, "")))
        )
      ),,";"
    )
    • Harun24HR's avatar
      Harun24HR
      Bronze Contributor
      Well. But TEXTJOIN() have a character limitation and we must be aware of that for large data set. For small data set, this is a good alternative.
    • tmehringer01's avatar
      tmehringer01
      Copper Contributor

      Harun24HR Works like a charm!  There are some advanced functions in there that I'm going to need to dig into to understand.  Looks like the formula even caught one output that I missed.

       

      Looks like they need to pay you more!  Thanks again for your help!

Resources