• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How do I do the opposite of FILTER formula in Cell L2?

arthurz11

Did You try to answer to my two questions?
Yes, I only want to use the FILTER formula to get the results. Please note that djc post #24 wrote two FILTER formulas and both FILTER formulas displays only the x,y duplicates. But I also need the formula to display only the x,y non-duplicates. The Excel worksheet that better explains what I need it to do.
 

Attachments

  • SAMPLE.xlsx
    12.9 KB · Views: 3
Your original formula can be modified to return the x,y pairs that appear only once by setting the optional [exactly_once] argument of the UNIQUE function to 1 or TRUE:

Code:
=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    u, UNIQUE(INDEX(f,,s),,TRUE),
    n, SEQUENCE(COUNT(u),,0),
    TRANSPOSE(INDEX(u,INT(n/2)+1,MOD(n,2)+1))
)
 
Very nicely done!!!! Test met all the requirements. Thank you soooooo much. Where do I click to show a solution to the problem has been solved?
 
You're welcome, and thanks for the feedback. I don't think there is any such "mark as solved" feature on this forum. You can choose to "Like" a response if you want to, but it's not a big deal to me... I'm just happy to help. Cheers!
 
As an afterthought, you could also eliminate the final TRANSPOSE function by utilizing the [columns] argument (instead of rows) in the final SEQUENCE function:

Code:
=LET(
    ...
    n, SEQUENCE(,COUNTA(u),0),
    INDEX(u,INT(n/2)+1,MOD(n,2)+1)
)

This can be applied to each of the working formula variations discussed thus far.
 
As an afterthought, you could also eliminate the final TRANSPOSE function by utilizing the [columns] argument (instead of rows) in the final SEQUENCE function:

Code:
=LET(
    ...
    n, SEQUENCE(,COUNTA(u),0),
    INDEX(u,INT(n/2)+1,MOD(n,2)+1)
)

This can be applied to each of the working formula variations discussed thus far.
Thank you again. However, I am very satisfied with the formula using the FILTER function. FYI: I have inform (with a link) to all other Excel website forums of you (djc from Chandoo.org) for creating a solution to the formula problem.
 
No worries, you don't have to use it. However, just to clarify, the "afterthought" was not a replacement for the FILTER function, but rather a simplification of the final two steps. The ellipsis (...) was meant to represent everything that came before the final two steps in each of the working formulas discussed thus far. The suggested revisions in their entirety would look like this:

Distinct List (original):
Code:
=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    u, UNIQUE(INDEX(f,,s)),
    n, SEQUENCE(,COUNTA(u),0),
    INDEX(u,INT(n/2)+1,MOD(n,2)+1)
)

Unique List (only once):
Code:
=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    u, IFERROR(UNIQUE(INDEX(f,,s),,1),""),
    n, SEQUENCE(,COUNTA(u),0),
    INDEX(u,INT(n/2)+1,MOD(n,2)+1)
)

Duplicates List (version 1):
Code:
=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    v, INDEX(f,,s),
    x, INDEX(v,,1),
    y, INDEX(v,,2),
    u, UNIQUE(FILTER(v,MMULT((x=TRANSPOSE(x))*(y=TRANSPOSE(y)),IF({1},1,x))>1,"")),
    n, SEQUENCE(,COUNTA(u),0),
    INDEX(u,INT(n/2)+1,MOD(n,2)+1)
)

Duplicates List (version 2):
Code:
=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    v, INDEX(f,,s),
    a, UNIQUE(v),
    b, UNIQUE(v,,1),
    u, FILTER(a,ISERROR(XMATCH(INDEX(a,,1)&"|"&INDEX(a,,2),INDEX(b,,1)&"|"&INDEX(b,,2))),""),
    n, SEQUENCE(,COUNTA(u),0),
    INDEX(u,INT(n/2)+1,MOD(n,2)+1)
)

Notice how COUNTA(u) is placed in the [columns] argument of SEQUENCE, eliminating the need for TRANSPOSE in the final step.
 
Hey! I just noticed an error when there is no data (all blanks in a row). I have forgotten that sometimes I do not get any x,y coordinates. When I was doing the long version, in one of the rows the data was all blanks. Please try it, delete the data in range A2:J2 and the results in TABLE TWO will result in the error #CALC?. So it gave me #CALC? error on the formulas below. Where do I put the IFERROR on each formula so that I don't get the #CALC? error? If you place the IFERROR at the beginning of the formula, will it be place at the same spot for the other formulas? Below are the formulas you wrote in which I decided to use on my worksheet. I appreciate your energy and time in helping me.


Code:
=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    v, INDEX(f,,s),
    x, INDEX(v,,1),
    y, INDEX(v,,2),
    u, UNIQUE(FILTER(v,MMULT((x=TRANSPOSE(x))*(y=TRANSPOSE(y)),IF({1},1,x))>1,"")),
    n, SEQUENCE(COUNTA(u),,0),
    TRANSPOSE(INDEX(u,INT(n/2)+1,MOD(n,2)+1))
)

=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    v, INDEX(f,,s),
    x, INDEX(v,,1),
    y, INDEX(v,,2),
    u, UNIQUE(FILTER(v,MMULT((x=TRANSPOSE(x))*(y=TRANSPOSE(y)),IF({1},1,x))>1,"")),
    n, SEQUENCE(COUNTA(u),,0),
    TRANSPOSE(INDEX(u,INT(n/2)+1,MOD(n,2)+1))
)

=LET(
    f, FILTER(A2:J2,A2:J2<>""),
    s, SEQUENCE(COLUMNS(f)/2,2),
    u, UNIQUE(INDEX(f,,s),,TRUE),
    n, SEQUENCE(COUNT(u),,0),
    TRANSPOSE(INDEX(u,INT(n/2)+1,MOD(n,2)+1))
)
 
The simplest fix that should work for all three formulas is to put {"",""} in the [if_empty] argument of the first FILTER function:

Code:
=LET(
    f, FILTER(A2:J2,A2:J2<>"",{"",""}),
    ...
)

However, you will also need to use COUNTA(u) instead of COUNT(u) with the last SEQUENCE function.
 

arthurz11

Okay, only formula solution.

It's good that You wrote to update other sites which You've cross-posted this case.
It's common sense to let others know where and especially: what did You expect?​
After You've done above.
You can add to end of Your thread title [SOLVED]
( or I can add it )
 
Back
Top