# \[SOLVED\] Difference between two lists

**URL:** <https://connect.superhuman.com/t/solved-difference-between-two-lists/7203>\
**Category:** Ask the Community\
**Created:** [March 27, 2019, 9:14am UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203 "2019-03-27T09:14:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Sherman](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/tim_sherman/32/8505_2.png) [@Tim\_Sherman](https://connect.superhuman.com/u/Tim_Sherman)\
**Post date:** [March 27, 2019, 9:14am UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/1 "2019-03-27T09:14:59Z")

</div>

Hi there

Does anyone know whether there is a function in Coda to return the difference between two lists? e.g. `Difference(list(a,b,c),list(a,b,c,d,e))` would return `list(d,e)`. Is there a way to do this with a combination of existing functions. Sorry, I’m not a programmer, so this isn’t second nature to me.

Cheers!

---

<div class="post-metadata">

**Author:** ![Krunal\_Sheth](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/krunal_sheth/32/5936_2.png) [@Krunal\_Sheth](https://connect.superhuman.com/u/Krunal_Sheth)\
**Post date:** [March 27, 2019, 1:39pm UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/2 "2019-03-27T13:39:23Z")

</div>

`List("A","B","C", "D", "E").Filter(Not(List("A", "B","C").Contains(CurrentValue)))` should work.

---

<div class="post-metadata">

**Author:** ![Tim\_Sherman](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/tim_sherman/32/8505_2.png) [@Tim\_Sherman](https://connect.superhuman.com/u/Tim_Sherman)\
**Post date:** [March 27, 2019, 9:51pm UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/3 "2019-03-27T21:51:16Z")

</div>

Aargh, so obvious in hindsight! 😳

Thanks @Krunal_Sheth

---

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [April 7, 2019, 2:48am UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/4 "2019-04-07T02:48:38Z")

</div>

> [@Tim\_Sherman](#):
>
> List(“A”,“B”,“C”, “D”, “E”).Filter(Not(List(“A”, “B”,“C”).Contains(CurrentValue)))

I tried this, and while it worked for the small list (a,b,c,d,e), it did not work with my lists on my table.

I have two lists. One with 159 text values and one with 155 values. Im trying to locate the 4 values that are missing with the given formula, but instead of outputting those 4, it is outputting all 159 from the larger list.

Any ideas why???

---

<div class="post-metadata">

**Author:** ![Krunal\_Sheth](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/krunal_sheth/32/5936_2.png) [@Krunal\_Sheth](https://connect.superhuman.com/u/Krunal_Sheth)\
**Post date:** [April 7, 2019, 4:28am UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/5 "2019-04-07T04:28:52Z")

</div>

If I have to guess, I would say both lists re containing values of different types. If that’s not the case please reach out to support and one us would take a look.

---

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [April 7, 2019, 1:59pm UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/6 "2019-04-07T13:59:46Z")

</div>

Thanks for reaching out. That was my guess as to what the issue was as well, but it seems as though my types are the same.

Here is a screenshot of what im currently doing. Do you see anything amiss?

 ![22%20AM](https://global.discourse-cdn.com/coda1/original/2X/a/a136934169fa5313487f9f19554acd443bf4b3df.png)

The green list contains 159 names while the pink likst contains 155 names, but for some reason it is not filtering out those 4 ??

---

<div class="post-metadata">

**Author:** ![shishir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/shishir/32/6017_2.png) [@shishir](https://connect.superhuman.com/u/shishir)\
**Post date:** [April 7, 2019, 2:27pm UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/7 "2019-04-07T14:27:10Z")

</div>

This is because `List(Table)` is creating a List with a single entry, where that entry is itself a list of all the values in that column of the table. You can see this by writing a formula which is `List(All Students Master.Student Name)` or `List(All Students Master.Student Name).Count()`

If you remove both the `List()` portion, it should work as `All Students Master.Student Name.Filter(Not(Scott - IEPs.Student Name to Text).Contains(Current Value)))`

Note that you could also write this as a more standard filter – `All Students Master.Filter(Scott IEPs.Student Name to Test.Contains(Student Name).Not())`

Does that work better?

---

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [April 7, 2019, 3:00pm UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/8 "2019-04-07T15:00:32Z")

</div>

Thank you @shishir! Everything you said makes sense, but for some reason I’m still coming up with errors.

Here is a screenshot of what is happening

 ![26%20AM](https://global.discourse-cdn.com/coda1/original/2X/7/703963f0e03fc8b0bcea2c47d1ed188e214be655.png)

Any ideas?

---

<div class="post-metadata">

**Author:** ![shishir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/shishir/32/6017_2.png) [@shishir](https://connect.superhuman.com/u/shishir)\
**Post date:** [April 7, 2019, 3:49pm UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/9 "2019-04-07T15:49:23Z")

</div>

Ah sorry, looks like I had a typo in my suggestion. Good learning moment though - in that formula, `Not()` is in the wrong place. It’s testing `Not(column)` which is going to return true or false, and then passing that into the `Contains()` function. The second variation should work (`All Students Master.Filter(Scott IEPs.Student Name to Test.Contains(Student Name).Not())`) - it’s one of the reasons I tend to prefer dot notation, it’s easier to prevent errors.

I also wrote up a bit of step-by-step example of what each of these formulas are doing here:

https://coda.io/embed/puW8RMd8fq/_susCa?viewMode=embedplay&hideSections=true

---

<div class="post-metadata">

**Author:** ![Scott\_Weir](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/scott_weir/32/10111_2.png) [@Scott\_Weir](https://connect.superhuman.com/u/Scott_Weir)\
**Post date:** [April 7, 2019, 5:35pm UTC](https://connect.superhuman.com/t/solved-difference-between-two-lists/7203/10 "2019-04-07T17:35:11Z")

</div>

Thank you so much! It works now!
