1

I have a matrix of data in Excel and I want to write in a row the unique values in that data using only formulas. Most of the formulas I have found so far write the unique values into a column and takes the data from a single column. I attach an image of an example of what I need.

In the example the data is in B2:D4 and the unique results will be printed in F2:I2, thank you in advance for the help

example of exercise

4 Answers 4

1

Apply this array formula in F2 with CSE,

=IFERROR(INDEX($B$2:INDEX($B:$B, MATCH(1E+99, $B:$B)), MATCH(0, COUNTIF($E2:E2, $B$2:INDEX($B:$B, MATCH(1E+99, $B:$B))), 0)),
 IFERROR(INDEX($C$2:INDEX($C:$C, MATCH(1E+99, $C:$C)), MATCH(0, COUNTIF($E2:E2, $C$2:INDEX($C:$C, MATCH(1E+99, $C:$C))), 0)),
 IFERROR(INDEX($D$2:INDEX($D:$D, MATCH(1E+99, $D:$D)), MATCH(0, COUNTIF($E2:E2, $D$2:INDEX($D:$D, MATCH(1E+99, $D:$D))), 0)), TEXT(,))))

... and fill right.

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

thank you for this, one question though, I want to only look in B2:D4 and nowhere else I only have to change the MATCH function right?
Yes. You have a problem in that column B only has values to the third row and the other two have values to the fourth. Blocking it with B2:D4 means that you will get a zero value (blank cell) somewhere. The above disregards blank cells by only looking at the cells with numbers but that is a problem if you have more numbers underneath.
1

The closest I can get is to give you a unique list in order of largest to smallest:

=AGGREGATE(14,6,$B$2:$D$4/(COUNTIF($E$2:E2,$B$2:$D$4)=0),1)

enter image description here

1 Comment

Conversely, smallest-to-largest would start with =AGGREGATE(15,6,...
1

With data in B2 through D4, in F2 enter:

=MIN($B$2:$D$4)

and in G2 enter the Array Formula:

=MIN(IF($B$2:$D$4>F2,$B$2:$D$4))

and copy across:

enter image description here

Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.

Comments

-1

Do you have to do it using only formulas? The Remove Duplicates function under the Data tab sounds perfect for this sort of problem. I am not sure if Remove Duplicates can produce horizontal data, but the transpose function can easily solve that.

2 Comments

Remove Duplicates will not work in this instance as it will try to compare whole rows to each other and since none match it would return the whole range as is.
Also, i need to use formulas because the process is repeated many times in a large group of datasets

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.