ggmkp
ggmkp

Reputation: 725

Excel Formula for Comparing 4 Columns but Treating 2 Columns together?

I am trying to compare 4 columns (or 2 columns in each sheets).

Whether the price for the SKU has changed or not. The data isn't sorted so the range have to be by columns.

I get error using below formula...

IF(COUNTIF("a:a" & "b:b","c:c" & "d:d")>0,"",Changed) or

=IFERROR(INDEX(A:B,MATCH(A1,A:A,0)),"",Changed) but the data isn't always sorted

Column(A+B)    Column(C+D)
SKU  Price     SKU  Price
AAA  59.95     DDD  129.99
BBB  49.95     BBB  159.00    Changed
CCC  49.95     CCC  159.00    Changed
DDD  129.99    AAA  59.99

Upvotes: 0

Views: 15959

Answers (3)

zx8754
zx8754

Reputation: 56249

Put this formula to Column E:

=IF(VLOOKUP(C1, $A$1:$B$4, 2, FALSE) = D1, "", "Changed")

Upvotes: 2

Jerry
Jerry

Reputation: 71598

If the SKU occurs only once in each column, I would go for VLOOKUP:

=IF(VLOOKUP(C2, A:A, 2, 0) = D2, "", "Changed")

If column A:A can contain more than one of the same SKU and column C:C will contain only one SKU, I would use SUMIF:

=IF(SUMIF(A:A, C2, B:B) = D2, "", "Changed")

If column A:A and C:C can contain any number of SKU, then I would use this:

=IF(SUMIF(A:A,C2,B:B)=SUMIF(C:C,C2,D:D),"","Changed")

Upvotes: 4

Doug Glancy
Doug Glancy

Reputation: 27488

Put this in E2 and drag down:

=IF(SUMPRODUCT((A2:A5=C2)*(B2:B5=D2))>0,"","Changed")

Adjust the range as necessary.

Upvotes: 1

Related Questions