Filter a list with another list (difference)

List 1 and List 2. Is there a way to remove all of the items in List 2 from List 1?

How can I get this?
List 1 = 1,2,3,4,5,6,7,8,9
List 2 = 2,5,9
List 1: Filtered = 1,3,4,6,7,8

Lists have merge and intersect, but those just add to the list. I need to subtract from it, or take the difference of two lists.

Alternatively, is there a way to get the remainder of a list intersect? @emmanuel

Try using filter on List 1, constraint: List 2’s list doesn’t contain This number.

list A: 1, 2, 3, 4, 5, 6, 7, 8, 9
list B: 2, 4, 6
list A not including list B items: 1, 3, 5, 7, 8, 9

5 Likes