Seems elementary but I'm stumped

I’m hoping this is an easy one, though I have searched high and low. I thought it would be no sweat to compare two lists and return the oddball.

I have two lists (with elements in no particular order):

list1 := C;X;R;Q;N

list2 := X;Q;C;N

I would like to compare the two in a way that gets R as the result.

This formula only works when the lists are explicit in the formula:

@ReplaceSubstring(“C;X;R;Q;N”;“X;Q;C;N”;“”:“”:“”:“”)

But if the lists are the result of a formula, like the following, list1 is returned:

list1:= @Implode(@AttachmentNames);

list2:= PicFileName1 + “:” + PicFileName2 + “:” + PicFileName3 + “:” + PicFileName4;

Result := @Trim(@ReplaceSubstring(list1; list2;“”:“”:“”:“”));

Result

What am I doing wrong.

Subject: Seems elementary but I’m stumped

First: @implode returns a string, not a list.Second: variable1 + “:” + variable2 returns a string.

So - If I’ve written this correctly, You want to something more like the following:

list1:= @explode(@AttachmentNames);

list2:= PicFileName1:PicFileName2:PicFileName3:PicFileName4;

Result:=@Transform(list1;“X”;@if(@ismember(X;List2;X;@nothing)):@Transform(list2;“X”;@if(@ismember(X;List1;X;@nothing));

This should return a list of all members if list1 that aren’t in list2 to and all members of list2 that aren’t in list1.

Subject: Unstumped. Thank you.

Thank you, Peter, for pointing out the list vs. string issue and your formula insight!