???? on sumif?

dawnfoss

Board Regular
Joined
Apr 22, 2002
Messages
100
a b

1 ab 20
2 xy 10
3 kr 15

I want to add the values of b ONly if the values in a = xy or kr. The result should be 35.

Help!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
two ways follow:

=SUMPRODUCT((A1:A3={"Kr","xy"})*(B1:B3))

or

=SUMIF(A1:A3,"xy",B1:B3)+SUMIF(A1:A3,"kr",B1:B3)
 
Upvote 0
Is this ok?

=sumif($A$1:$A$100,"xy",$B$1:$B$100)+sumif($A$1:$A$100,"kr",$B$1:$B$100)

Hope that helps, -someone may post a shorter formula

Adam
 
Upvote 0
Hi,

Try,

=SUMIF(A1:A3,"ab",B1:B3)+SUMIF(A1:A3,"kr",B1:B3)

or

=SUMPRODUCT(((A1:A3="ab")+(A1:A3="kr"))*(B1:B3))

Bye,
Jay
 
Upvote 0
I'd suggest using the SUMIF version, which allows you to use the cell refs instead of "kr", etc. That is, you can put e.g., "xr" in E1 and "kr" in E2 and use:

=SUMIF(A2:A4,E1,B2:B4)+SUMIF(A2:A4,E2,B2:B4)

If the OR criteria/conditions count 3 or more, you might want to consider using:

=SUMPRODUCT((ISNUMBER(MATCH(A2:A100,E1:E3,0)))*(B2:B100))

where E1:E3 houses the OR criteria.

Aladin
 
Upvote 0
OH, AND thanks for not pointing out or making fun of the fact that I don't know how to add!

dawn
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,237
Members
448,555
Latest member
RobertJones1986

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