# SUMIF using range from 2 columns

#### TAPS_MikeDion

##### Well-known Member
Hi everybody,

Can SUMIF be used with a range from 2 columns? I'm trying to have it search columns G & H for a string, and if found, retrieve the totals from column I.

This formula currently works for 1 column (column H), but I also need it to search column G as well.

=SUMIF(H4:H382, "Union Station*",I4:I382)

Thanks for the help!

### Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Is this what you mean?

Book2
GHI
1UnionPlaza10
2TownHall20
3NorthRail30
4SouthRail40
5UnionStation50
6HomePlaza60
7EastStation70
8UnionStation80
9
10130
Sheet1
Cell Formulas
RangeFormula
I10I10=SUMPRODUCT(("Union"=G1:G8)*("Station"=H1:H8)*(I1:I8))

For more than 1 criteria you need sumifs, rather than sumif
Excel Formula:
``=SUMIFS(I4:I382,H4:H382, "Union Station*",G4:G382,"???")``

If you want to look for the same text in either of the two columns, then perhaps:

Excel Formula:
``=SUMPRODUCT(((LEFT(H4:H382,13)="Union Station")+(LEFT(G4:G382,13)="Union Station")),I4:I382)``

assuming the text won't be in both columns. If it might be:

Excel Formula:
``=SUMPRODUCT(--(((LEFT(H4:H382,13)="Union Station")+(LEFT(G4:G382,13)="Union Station"))>0),I4:I382)``

Wow, thank you for so many quick responses!

Unfortunately, as I was trying them all I realized that something else needs to be added to the formula.

Column H would only have "Union Station" as the criteria, but column G would need the "Union Station" criteria along with column H having "Cover Hours" as criteria.

Excel Formula:
``=SUMPRODUCT((H4:H382="Union Station")+((G4:G382="Union Station")*(H4:H382="Cover Hours")),I4:I382)``

Sorry for the very long delay. I was diagnosed with COVID and had been out of work for a week.

First...Fluff buddy, do you ever sleep? LOL

You're welcome & thanks for the feedback.

Hope you have recovered.

Not 100% yet, but close. Thank you. I was lucky enough not to lose taste / smell sensations like many have.

Replies
7
Views
166
Replies
5
Views
186
Replies
4
Views
420
Replies
0
Views
87
Replies
1
Views
95

1,203,082
Messages
6,053,419
Members
444,662
Latest member
AaronPMH

### 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