You are here:

# Excel/Excel: Compare multiple columns to return a result

Question
I have an Excel workbook with two worksheets. Sheet1 contains many columns and I want to compare three of them (A, B, C) with three similar columns (A, B, C) from Sheet2. Then, where there is a match I want to return the value in a fourth column (D) from the matching row in Sheet2 to a cell in a fourth column (D) on Sheet1. The rows in Sheet2 are all unique so there is only one possible match to a row on Sheet1.

In both Sheet1 and Sheet2: Column A is a number 1-10, Column B is one of two colors ("Red", "Blue"), and column C is one of four text options ("Cat", "Cat + 1", "Cat + 2", "Cat + 3"). Column D is populated on Sheet 2 with some value 100-300 that corresponds to the other values in its row.

I see the formula working like this, I just don't know how to write it: Where Sheet1 A+B+C = Sheet2 A+B+C, set Sheet1 D to Sheet2 D

Jamie,

Since you are returning a number, you can use this function in Excel 2007 or later

D2 of sheet1:
=Sumifs(Sheet2!\$D:\$D,Sheet2!\$A:\$A,\$A2,Sheet2!\$B:\$B,\$B2,Sheet2!\$C:\$C,\$C2)

then drag fill down column D

if you don't have Excel 2007 or later (Sumifs was introduced in Excel 2007), then post back.

--
Regards,
Tom Ogilvy

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.