How can I list in one cell, unique values in a row

I have the following data in an Excel spreadsheet

Team1   Team2   Team3   Team4
C             C             All          None

In the next cell in the row, I want to list values that are not duplicated (i.e. All and None) separated by a comma.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Here's one non-vba way to do that. Refer to the attached. It uses a series of IF formulas. Example of formula in column E:


This formula checks the value in column A against the values in B, C and D. If there are no matches, it will return the value in column A. Then it checks B, C and D for data. If one of those columns has a value, it will add a comma after the value in column A.  The formulas in columns F, G and H are somewhat similar. The results are seen in column I which uses the CONCATENATE function. Columns E-H are hidden.

Saqib Husain, SyedEngineerCommented:
You can also try this UDF

Function sansdups(rng)
    sansdups = ""
    For Each cel In rng
        If WorksheetFunction.CountIf(rng, cel) = 1 Then
            sansdups = sansdups & IIf(sansdups = "", "", ",") & cel
        End If
    Next cel
End Function

with the formula

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
elimishiaAuthor Commented:
Hello Flyster,

Thank-you for taking the time to create a sample spreadsheet.  Unfortunately, my spreadsheet doesn't allow for the use of hidden columns to do the multiple IFs.  Nesting the IFs would be cumbersome as there are likely to be up to 10 columns.  I am sorry - I should have been more specific about needing the formula (as well as the result) to be in a single cell.  

Using Match() in an array, I could see where the unique value were, but got stuck in not knowing how to extract the values.

Once again, thanks for your assistance.  As your suggestion does provide a solution in different circumstances, I will make it as an answer.  

CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

elimishiaAuthor Commented:
Hello Syed,

Thank-you for your assistance.  Although I was originally looking for a non-VBA solution, the UDF works beautifully. So I shall adopt it as my solution.

elimishiaAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for elimishia's comment #a40695306

for the following reason:

It helped that I have some knowledge of VBA. However, the code was simple and it worked.
elimishiaAuthor Commented:
The solution is straight forward and would work well on spreadsheets with free columns available to hold the various formulae.
Saqib Husain, SyedEngineerCommented:
You can also combine the helper columns into a long formula if you cannot accommodate the helper columns

elimishiaAuthor Commented:
Hello Syed,

Thank-you for this alternative suggestion.  It too works very well.

I have tried to mark both your suggestions as ANSWERS, without success.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.