SUMIF with two variables/conditions ?

behedwin

Active Member
Joined
Dec 10, 2014
Messages
399
Hey

I have a table with 3 columns

COLOR
NUMBER1
NUMBER2

An example can look like this:

Color
Number 1
Number 2
Green
1
10
Green
1
10
Red
2
20
Green
2
20
Yellow
3
30
Red
3
30
Green
4
10

<tbody>
</tbody>


Now i want to answer this question.
What is the total sum of Column Number2 with Column COLOR=Green and Column Number1=1

So Green have Two number1 column with the value "1"
So the answer should be 20 (10+10)

I am thinking something like this:
=SUMIF(A2:A8;"Green";B2:B8="1";C2:C8)

Or how should i write this?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
How about
=SUMIFS(C2:C8,A2:A8,"Green",B2:B8,1)
 
Upvote 0
How about
=SUMIFS(C2:C8,A2:A8,"Green",B2:B8,1)

Great that worked out just fine.
However i noticed a problem.
In column B where i have numbers i noticed i might also have a letter after the first number.

Can i somehow just read the first number reading from left.
So if B column have
1
2
3d
1
3c
4a
9

it would still just look at the first value in the string?

can i type like "1*" and it would look for 1 and anything that comes after?
 
Upvote 0
Try
=SUMPRODUCT((A2:A8="Green")*(LEFT(B2:B8)="1"),C2:C8)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,167
Members
448,870
Latest member
max_pedreira

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top