Filtering values based on comparisons with adjacent columns - excel

I want to compare column A in sheet 1 with column A in sheet 2, and only return matches from sheet 2.
I then, want to use the matching column A rows as a basis for a second comparison. The second comparison is to compare column B in sheet 1 with column B in sheet 2 and only return non matches from sheet 2.
Assume this is the data on sheet 1:
A B
2 4
2 4
2 3
3 3
and this is the data on sheet 2:
A B
2 4
3 3
2 4
3 3
So, only the third row will pass on both conditions. Any ideas how this can be done?

I want to compare column A in sheet 1 with column A in sheet 2 and only return matches from sheet 2
Type on cell C1, on sheet 1:
=IF(A1=Sheet2!A1,"True","")
Drag the formula to all rows on column A, which contain non blank cells.
The second comparison is to compare column B in sheet 1 with column B in sheet 2 and only return non matches from sheet 2.
Type on cell D1, on Sheet 1:
=IF(AND(C1="True",B1<>Sheet2!B1),"True","")
Drag the formula down.
Output on Sheet 1 should be like that:
A B C D
2 4 True
2 4
2 3 True True
3 3 True
Filter column C by True to observe the "first" condition's returns. Do the same to column D to retrieve the data which satisfies the "second" condition.

Related

Formula to Find if Number between a Range in 2 Columns and then Offset 1 column

I would like to write an Excel formula that looks at 3 columns and grabs value of the 1st column based on if the search value is in columns 2 or columns 3.
1st Column 2nd Column 3rd Column
a 1 5
b 6 10
c 11 15
Search Value 1: 13 Result: c
Search Value 2: 6 Result: b
Try below formula-
=INDEX($A$1:$A$3,MAX(($B$1:$B$3<=B6)*($C$1:$C$3>=B6)*(ROW($A$1:$A$3))))

Fill values from a list with conditions -Excel

I need to produce a formula, that can generate a list that follow to the below conditions,
Each letter can only appear in the same column again once the every letter in the list has been used.
If letter is in row 1 column 2 it can't be in row 2 column 1.
The same letter can't be in both columns at the same time.
Example,
List: A,B,C,D
Result,
Column 1 Column2
Row 1 A C
Row 2 B D
C A
D B
A C
Put your list in column A
then put this in the first cell, copy over one and down as far as desired:
=INDEX($A:$A,MOD((ROW(1:1)-1)+(COLUMN(A:A)-1)*2,COUNTA($A:$A))+1)

Counting instances across ranges in columns

I am creating a spreadsheet for my personal use. I need to count the number of times one column's values are equal to an adjacent column's.
Is there any way to do this in Excel without having to modify the formula every time a new row is added?
If you have column A and B now, add column C:
Column A Column B Column C
1 2 =countif(B:B, A1)
2 2
3 1
Then just copy the first value in column C, select the entire column C and paste :)
You will get:
Column C
1
2
0

Sum column based on condition based on corresponding column in excel

There are two column
A B
1 1
2 1
3 3
Now I want to sum column A if A-(B+C) is equal to 0.
so for above example sum would be 1+3 = 4
Adjust ranges as necessary:
=SUMPRODUCT((A1:A3=B1:B3)*A1:A3)

Keep on summing corresponding cell and compare with first column for summing up first column based on comparision in excel

Consider the following data setup:
_A_ _B_ _C_
1 1
2 1 1
3 3
Such that a formula would return the following results for columns B and C respectively:
_A_ _B_ _C_
4 2
Now I want to sum column A if A-(B+C) is equal to 0.
so for above example sum would be 1+3 = 4 on column B, since row 1 and 3 satisfy 1-1=0 first row, 3-3=0 third row. so A value on 1st and 2nd row is 1+3=4. Row 2nd doesn't satisfy 2-1=1 not 0 so ignore.
on column C, B+C in second row 2-(1+1) = 0 ,So it would be sum 2 in that column C, ignoring first and third row since it already has been counted on column B.
columns continue like D E....
So sum up from B to current column..so if i am in column B it will sum up till B.If in C B+C....If in D B+C+D etc and then compare with column A
Insufficient rep to comment, this is at least a partial answer and perhaps full.
I think you're looking for this to happen in some lower row in B:
=SUMPRODUCT(--(A1:A3=B1:B3),A1:A3)
And this in C:
=SUMPRODUCT(--(A1:A3-(B1:B3+C1:C3)=0),A1:A3)
Although as EEM points out all the sample rows satisfy this condition so you get "6" instead of "2"

Resources