Excel: I want to remove duplicate values in same row and many columns - excel

I want to delete duplicate values in same row and multiple column in excel... i want this
A B C D E F G H I J K RESULT
R1 8 0 1 8 1 5 8 1 9 5 5 80159
R2 7 8 7 7 4 5 0 7 6 8 9 78450689
R3 5 2 0 6 4 2 7 6 1 3 0 52064713
R4 4 3 5 0 7 2 5 3 2 4 8 4350728

If one has the Dynamic Array formula:
=CONCAT(UNIQUE(A1:K1,TRUE))
If not then the assumption is that 0 will never be in the first column and that the data is as you provided, one number per cell:
=MMULT(TRANSPOSE(MODE.MULT(IF(MATCH(A1:K1,A1:K1,0)=COLUMN(A1:K1),A1:K1*{1;1}))),TRANSPOSE(10^(COUNT(MODE.MULT(IF(MATCH(A1:K1,A1:K1,0)=COLUMN(A1:K1),A1:K1*{1;1})))-TRANSPOSE(ROW(INDEX($ZZ:$ZZ,1):INDEX($ZZ:$ZZ,COUNT(MODE.MULT(IF(MATCH(A1:K1,A1:K1,0)=COLUMN(A1:K1),A1:K1*{1;1})))))))))
Depending on ones version this may need to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
If it is text or the numbers are more than one digit then vba will probably be needed.

Related

Trouble Changing csv row based on column values in python3 and pandas

I am having issues trying to modify a value if columnA contains lets say 0,2,12,44,75,81 (looking at 33 different numerical values in columnA. If columnA contains 1 of the 33 vaules defined, i need to then change the same row of colulmnB to "approved".
I have tried this:
df[(df.columnA == '0|2|12|44|75|81')][df.columnB] = 'approved'
I get an error that there are none of index are in the columns but, i know that isn't correct looking at my csv file data. I must be searching wrong or using the wrong syntax.
As others have said, if you need the value in column A to match exactly with a value in the list, then you can use .isin. If you need a partial match, then you can convert to string dtypes and use .contains.
setup:
nums_to_match = [0,2,9]
df
A B
0 6 e
1 1 f
2 3 b
3 6 g
4 6 i
5 0 f
6 9 a
7 6 i
8 6 a
9 2 h
Exact match:
df.loc[df.A.isin(nums_to_match),'B']='approved'
df:
A B
0 6 e
1 1 f
2 3 b
3 6 g
4 6 i
5 0 approved
6 9 approved
7 6 i
8 6 a
9 2 approved
partial match:
nums_to_match_str = list(map(str,nums_to_match))
df['A']=df['A'].astype(str)
df.loc[df.A.str.contains('|'.join(nums_to_match_str),case=False,na=False),'B']='approved'
df
A B
0 1 h
1 4 c
2 6 i
3 7 d
4 3 d
5 9 approved
6 5 i
7 1 c
8 0 approved
9 5 d

SUM function produces a #VALUE! error when using in array formula

I have the following values in a sheet (in A1:G10) range:
1 1 1 1 1 1 1
2 2 2 2 2 2 2
3 3 3 3 3 3 3
4 4 4 4 4 4 4
5 5 5 5 5 5 5
6 6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8
9 9 9 9 9 9 9
10 10 10 10 10 10 10
I need to calculate the sum of differences of values between two rows in the array above when both rows are defined by row numbers, for example: sum of differences of values between 10-th and 1-st rows, between 9-th and 2-nd rows and so on. Row numbers I defined in J1:K10 range:
1 10
2 9
3 8
4 7
5 6
6 5
7 4
8 3
9 2
10 1
Then I selected L1:L10 range, and in the first cell of it I entered the following formula:
=SUM((OFFSET(A1,INDEX(K1:K10,ROW(K1:K10)-ROW(K1)+1)-1,0,1,7)-OFFSET(A1,INDEX(J1:J10,ROW(J1:J10)-ROW(J1)+1)-1,0,1,7)))
and then pressed CTRL+SHIFT+ENTER so the formula is enterd as an array formula. And the formula returned a #VALUE! error for each cell in the range.
I tried to evaluate the formula, and it evaluates correctly except the last step: SUM({9,9,9,9,9,9,9}) becomes a #VALUE!
Here is a screenshot of the sheet for clarity:
What I'm doing wrong? Please suggest.
use SUMPRODUCT in L1:
=SUMPRODUCT(INDEX($A$1:$G$10,J1,0)-INDEX($A$1:$G$10,K1,0))
and copy down.

find number appears more

1 2 2
4 5 4
3 3 3
0 1 0
1 2 2
4 4 3
4 5 4
4 5 4
3 4 4
3 4 4
4 4 4
3 4 3
I have above three columns in excel,how to find the number that appears more times, for example, first row is 2 (because it has two 2 and one 1)
Assuming your layout is such that the first column is A, second column is B, etc., then you could put the following in cell D1:
=IF(ISNUMBER(MODE(A1:C1)),MODE(A1:C1),0)
This also outputs 0 in case there is a tie. You can replace the 0 with whatever excel expression you want if you don't want ties to result in a 0.

how find unique value from Different column

A B ANSWER
1 1 1
3 3 3
1 2 1
2 4 2
4 4 4
5 5 5
6 6 6
i have used this function to get above answer "=IF(ISERROR(MATCH(A2:A8,$B$1:$B$8,0)),"",A2)"
but I need answer like this i have given below (suppose if you take value in A column "1"
Which is repeated only once in column B)
A B ANR
1 1 1
3 3 3
1 2 0
2 4 2
4 4 4
5 5 5
6 6 6
I've just wrapped your formula in a condition that returns 0 where the count of the A value from start to the current row is more than one:
=IF(COUNTIF(A$1:A2,A2)>1,0,IF(ISERROR(MATCH(A2:A8,$B$1:$B$8,0)),"",A2))
.
An alternative formula that gives the same results as above for the sample data provided but may (or may not) suit the additional requirements mentioned in a comment:
=IF(COUNTIF(A$2:A$10,A2)<=COUNTIF(B$2:B$10,A2),A2,IF(COUNTIF(A$2:A2,A2)>COUNTIF(B$2:B$10,A2),0,IF(COUNTIF(A$2:A$10,A2)>COUNTIF(B$2:B2,A2),A2,0)))

OpenOffice Calc Compare 2 cols and print col if true

I have two cols in Calc and want to compare both and print in col if it's a duplicate. Example:
A B C
1 2
2 2 2
3 3 3
4 5
5 6
6 7
7 7 7
8 8 8
9 9 9
What is the formula I need to print in col c to get this?
The formula to use in column C, to test if columns A and B are equals
=IF(A1=B1;B1;"")

Resources