Comparing Lists inside a row

Hi there, I am trying to compare two lists inside a row.

Here is a simplified doc:
https://coda.io/d/Compare-Items-in-a-Cell_d6N-Q_ofrDS

What I am hoping to get is which values are not in the second column, see the screenshot below:

I found this but it does not seem to work: Shishir's Coda Community Tips and Tricks

Thanks for your help!

hi @Robin_Bigio , good question!

I could not access your doc, so I recreated it rapidly on my side,below the screenshots and the formula I applied:

thisRow.[List 1].Filter(CurrentValue.Contains(thisRow.[list 2]).Not())

best, Christiaan

3 Likes

@Christiaan_Huizer, that totally worked! Thanks so much!

Can you explain why? I am not sure I get it…

hi @Robin_Bigio , great that it works :wink:

in the column ‘List 1’ you have on the first row a list with 4 items. Each item is evaluated via the filter as ‘CurrentValue’ to see if it contains a value that lives in Column List 2. The Filter first checks item 1 (which is the first currentvalue) and checks if it lives in List 2, then it checks item 2 (the 2nd currentvalue) to see if this one lives in List 2 and so on.

Without the Not() you would have as result ‘item 2’, but you needed the difference, so we turned the result upside down and instead asked for ‘contains not’ you write as Contains().Not().

I hope it helps a bit.

last but not least, would you be so kind to mark my contribution as solution, that is mainly important for those who provide support of all sorts (for free).

Enjoy your day, Christiaan

3 Likes

Amazing, thanks so much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.