# Would SUMIF be the correct formula to use in this situation

##### New Member
Hi all,

I have a worksheet with 5 columns that has a list of values based off of bed/bath combinations. For Example:

A B C D E
Beds Baths Linens Consumables Totals
1 1 1 9.75 15.10 24.85

2 3 2 13.5 19.45 32.95

3 4 4 26.6 32.10 58.70

4 4 2 23.5 29.50 53.00

5 2 2 11.5 17.65 29.15

I have 2 cells in a row that have the specific Bed/Bath combo, and want to be able to give the total of the linens and consumables based off the two values.

so in another sheet I have:

Bed Bath
2 2

I have tried this VLOOKUP, but it doesn't seem to work: =VLOOKUP(Sheet2!I2:J2, Sheet2!\$A\$2:\$F\$34, 4, FALSE)

I think the problem is that I have two cells that need to be exactly matched in the above range, and VLOOKUP only seems to be able to successfully match one cell as the criteria.

So should I use the SUMIF Formula? And if so how would I type it out so it works? Thanks

Last edited:

### Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi,
I think you could accomplish that using the SUMIFS function (it depends on the version of Excel that you're using).
- Data is in Sheet1, range A1:E5
- Bed/Bath combo is in Sheet2 (starting at Row 2 for the headers.)

=SUMIFS(Sheet1!C\$2:C\$6;Sheet1!\$A\$2:\$A\$6;Sheet2!\$A2;Sheet1!\$B\$2:\$B\$6;Sheet2!\$B2)

It gives the total of linens, but you can drag it to fill consumables and totals if needed.

Hope it helps.

Another option is to use SUMPRODUCT function.
Assuming that:
- Data is in Sheet1, range A1:E5
- Bed/Bath combo is in Sheet2 (starting at Row 2 for the headers.)

=SUMPRODUCT(--(Sheet1!\$A\$2:\$A\$6=Sheet2!\$A2),--(Sheet1!\$B\$2:\$B\$6=Sheet2!\$B2),Sheet1!C\$2:C\$6)

Just drag it to fill the comsumables and totals if needed.
Hope it helps.

Another option is to use SUMPRODUCT function.
Assuming that:
- Data is in Sheet1, range A1:E5
- Bed/Bath combo is in Sheet2 (starting at Row 2 for the headers.)

=SUMPRODUCT(--(Sheet1!\$A\$2:\$A\$6=Sheet2!\$A2),--(Sheet1!\$B\$2:\$B\$6=Sheet2!\$B2),Sheet1!C\$2:C\$6)

Just drag it to fill the comsumables and totals if needed.
Hope it helps.

This worked, thanks!

Replies
1
Views
858
Replies
1
Views
347
Replies
3
Views
1K
Replies
9
Views
209
Replies
1
Views
387

1,196,368
Messages
6,014,877
Members
441,853
Latest member
Carlp16

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back