Excel: Removing Duplicate Values Using Array Formula For Multiple Columns - arrays

I am trying to remove the duplicates from 7 different columns and combine the unique values into one column and I can't find a way to do that using an Excel formula
I've tried the array approach below, but it doesn't work for for more than one column:
=INDEX($A$11:$A$100000, MATCH(0, COUNTIF($C$11:C11,$A$11:$A$100000), 0))
Here's what I'd like ideally:
Starting data:
Column 1: a b d c b i
Column 2: c g h f d c
Column 3: f e a g b a
Ending result:
a
b
c
d
e
f
g
h
i
...
(order not important)
Any solutions would be appreciated.

Not sure if this answers the question exactly, but you could try using COUNTIFS to identify rows where combinations of two or more columns contain duplicate values:
=COUNTIFS($B:$B,$B1,$C:$C,$C1)
This formula will return the number of rows where the value in B1 and C1 is duplicated. You can copy and paste it down to every row in your formula, or use it as an array formula.
There's more on how to do this here:
http://fiveminutelessons.com/learn-microsoft-excel/find-duplicate-rows-excel-across-multiple-columns

Related

How to print the value of a cell if two of the excel columns match

I want to paste the cell value of column F if Column A and Column E match.
For instance since A2 = E3, B/2 should be the output.
What formula should I use?
You can use this formula =IFERROR(INDEX(F2:F5,MATCH(A2:A5,E2:E5,0)),"no result")

How to get an array that summarizes sometimes repeated negative or positive values, also writing the number of repetitions in a separate column?

I got a list with "Move" (Column C) values.
How to create "Sorted" list (Column E,F) , which repeat number in Column F and write action in Column E as 1, if next value go opposite way from zero;
And summarize 2 or more numbers in Column F, and write action in Column E as 2 or more, if they going together same way from zero;
?
Screenshot shows correct result:
Google Sheets example link:
https://docs.google.com/spreadsheets/d/13WL9pD7glAZxOIhsXq6k-ZG0Z8bbGAmMOhtGrW3mRTA/edit?usp=sharing
Here's what I came up with in cell E1 on the mk.idea tab
=ARRAYFORMULA(array_constrain(query({C2:C\LOOKUP(A2:A;filter({A2:A;1}; sign({C2:C;0})<>sign(n(C:C))))};"select Count(Col2),sum(Col1),Col2 where Col2>1 group by Col2 label Count(Col2)'Sorted',Sum(Col1)''";0);9^9;2))
Does that give you what you're after?

Index Match for two criteria, then exclude previously returned values

Using Google Sheets, I'm trying to figure out how to do an index match so I can find a value based on two crtieria...then as I continue to use the formula it will exclude all previously returned values.
Assuming 3 columns in all examples...
Sheet 1:
a b <blank>
a b <blank>
I'm trying to return values into the column by looking for both a and b in another sheet...but I want only one new value to be returned each time.
Sheet 2:
a b c
a b d
a b e
So, for sheet one, I'd like the to be:
a b c
a b d
I'm sure this is possible somehow, I just don't know how to make it happen...
try:
=ARRAYFORMULA(IFNA(VLOOKUP(A1:A&B1:B&COUNTIFS(A1:A&B1:B, A1:A&B1:B, ROW(A1:A), "<="&ROW(A1:A)),
{Sheet2!A1:A&Sheet2!B1:B&COUNTIFS(Sheet2!A1:A&Sheet2!B1:B, Sheet2!A1:A&Sheet2!B1:B,
ROW(Sheet2!A1:A), "<="&ROW(Sheet2!A1:A)), Sheet2!C1:C}, 2, 0)))

Excel lookup in multiple column array, return row

I need to lookup the value of something in a table and then return the row that it's in. The value can be in any column, so Match doesn't seem ideal. What's the best way to do this?
As an example, say the table has 2 columns. Column 1 has A, B, C, D. Column 2 has E, F, G, H. I want to find out which row "G" is in, so I want to somehow return "3" without knowing beforehand that "G" is in column 2.
Please try:
=IFERROR(MATCH("g",A:A,0),MATCH("g",B:B,0))
and so on if more columns.
Assuming your data isn't duplicated, given this layout:
Column 1 Column 2
A E
B F
C G
D H
,this formula:
=MAX(IF(A1:B5="G",ROW(A1:B5),0))
will do what you want. In this case it would return 4. It also has the ability to work with an infinte number of columns (if nothing is duplicated, also a lot of columns might impact performance)
It's an array formula so you have to confirm it with Ctrl + Shift + Enter

Excel: Pair things up between two columns (A and B), and show unpaired values in columns C and D

Excel buffs:
There are many results showing up when searching for comparisons between two columns (ie: using VLOOKUP) but none of the results I have looked so far seems to do what I need in this particular way:
Column A has following values: Z, Q, V, V, T, T
Column B has following values: V, T, T, M
Column C will display Z, Q, V (here we have one V because one set of 'V' pairs up, leaving us with one unpaired 'V')
Column D will display M
The other examples I've seen so far assumes Column C will not have 'V' in it because it's already found in Column A, regardless of how many times it showed up.
Basically, instead, I need values between two columns paired up and removed, but leave me with any "odd ones" out.
I've been unable to figure this one out using formulae - I've resorted to sorting everything first, then shifting cells in either Column A or B downwards until Columna A and B either have matching values or odd one out in each row
Thanks in advance
Edit: Another way of saying it: I'd like to "eliminate" paired up values from Columns A and B, until all pairs have been removed, leaving me with remaining values in Column A and B
Let's make the assumption that the answers in C/D are allowed to reside in the same row as the unmatched originals in A/B.
Here's the formula for C1, copy and paste it down:
=REPT(A1,
MAX(0,MIN(1,COUNTIF($A:$A,A1)
-COUNTIF($B:$B,A1)
-IF(ROW()=1,0,COUNTIF(OFFSET($C$1,0,0,ROW()-1,1),A1))
)))
Basically, we want to "repeat" the corresponding value in column A if we haven't found a match for it in B and we haven't already accounted for it in C so far.
There's logic in there to ensure that OFFSET() doesn't refer to a zero-height range, and that we repeat either 0 or 1 time, no more and no less, on each row of C.
The formula for D1 is similar, but reversed to compare B back to A:
=REPT(B1,
MAX(0,MIN(1,COUNTIF($B:$B,B1)
-COUNTIF($A:$A,B1)
-IF(ROW()=1,0,COUNTIF(OFFSET($D$1,0,0,ROW()-1,1),B1))
)))

Resources