I would like to change the color of a row if two rows with the same contents in one column differ in value in another column - excel

So I have been working on this for a while now but can't seem to get it.
Essentially if the contents in column C (NAME) match, I need to see if their rows match value in column K (Y/N).
If they differ in Column K, the entirety of both rows should turn yellow.
Additionally, I would like that if they match in column C, and they are both "No" in column K, both rows turn red.
I believe this to be done as a custom rule in conditional formating but this is all I could come up with, unsure how to proceed. (I am operating in Google Sheets since its a shared doc but I can manage with Excel.
=AND($C1<>"",COUNTIF($C:$C,$C1)>1, COUNTIFS($C:$C,$C1,$K:$K,$K1)>0)
Some sample data; here both of Jane's rows should be red and Alex's rows should be yellow:
43425.45184 NA Morg 4 7 5 6 7 6 6 Yes
43423.65523 NA Alee 4 9 8 7 8 8 9 Yes
43425.4461 NA Alee 4 8 8 8 8 8 8 Yes
43420.93822 NA Bale 4 8 7 7 6 10 7 Yes
43424.40326 NA Jane 5 9 8 8 9 9 7 No
43430.45766 NA Jane 5 10 10 10 10 10 10 No
43424.51362 NA Alex 3 8 8 8 4 6 6 Yes
43430.48237 NA Alex 4 6 3 5 2 7 6 No
43428.76583 NA Allison 4 8 8 8 7 6 8 Yes

Think these two will do it.
=AND(COUNTIF($C:$C,$C1)=2,COUNTIFS($C:$C,$C1,$K:$K,"No")=2)
Above is fill red
=AND(COUNTIF($C:$C,$C1)=2,COUNTIFS($C:$C,$C1,$K:$K,"Yes")=1)
Above is fill yellow

Related

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

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.

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.

count with multiple crieria

I am stuck with a problem. Lets say I have the following data in range A1:K4
row1 1 2 3 4 5 6 7 8 9 10
row2 2 3 4 5 6 7 8 9 10 11
row3 3 4 5 6 7 8 9 10 11 12
row4 3 5 6 7 8 9 10 11 12 13
And the following data in range N1:P4
1 2 3
2 3 4
3 4 5
11 12 13
I want formulas in range R1:R4
The desired output should be R1=1, R2=2, R3=3, R4=1
i am trying to evaluate first set of numbers 1 2 and 3 and check in every row from row1 to row4 and find out how many rows matched all 3 numbers and the put the value in cell R1.. continue this for all 4 sets of number. Can someone help me with a formula?
Thanks
You could use this formula in R1 copied down to R4
=SUMPRODUCT((MMULT(COUNTIF(OFFSET(B$1:K$4,ROW(B$1:K$4)-ROW(B$1),0,1),N1:P1),{1;1;1})=3)+0)
although I've cheated a bit, there, because {1;1;1} is variable based on the number of columns in N1:P1 (and so is the 3), so for a more generic version (which would allow N1:P1 to be any size row) you can use this "array formula"
=SUM((MMULT(COUNTIF(OFFSET(B$1:K$4,ROW(B$1:K$4)-ROW(B$1),0,1),N1:P1),TRANSPOSE(COLUMN(N1:P1)^0))=COLUMNS(N1:P1))+0)
confirmed with CTRL+SHIFT+ENTER

add values using the first cell as index

I have 3 columns
A B C
1 ABC 5 1
2 CDE 6 3
3 CDE 7 3
4 ABC 8 4
5 FGH 9 5
6 GFH 1 6
7 FGH 2 7
8 GFE 3 8
9 ABC 4 9
How do I sum up the values for column B and C for the cells that contain ABC. Because ABC is on row number 1, 4, and 9. But how do I use this when I have plenty of rows.
Consider:
=SUMPRODUCT((A1:A9="ABC")*(B1:B9))+SUMPRODUCT((A1:A9="ABC")*(C1:C9))

Data fill in specific pattern

I am trying to fill data in MS Excel. I am given following pattern:
1 2
1
1
2 5
2 5
2
3
3 6
3
4
4
5 4
And I want my output in following format:
1 2
1 2
1 2
2 5
2 5
2 5
3 6
3 6
3 6
4
4
5 4
I tried using if(b2,b2,c1) in column 3. but that doesn't solve the problem for a=3 and a=4.
Any idea how to do this in Excel?
With sorting thus:
(the effect of which in this case is merely to move 6 up once cell) and a blank row above:
=IF(AND(A2<>A1,B2=""),"",IF(B2<>"",B2,C1))
In C2 and copied down should get the result you ask for from the data sample provided.

Resources