![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Posts: 91
|
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! |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Calgary, Alberta Canada
Posts: 2,065
|
two ways follow: =SUMPRODUCT((A1:A3={"Kr","xy"})*(B1:B3)) or =SUMIF(A1:A3,"xy",B1:B3)+SUMIF(A1:A3,"kr",B1:B3) |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,027
|
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 |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Try: =SUMIF(A2:A4,"xy",B2:B4)+SUMIF(A2:A4,"kr",B2:B4) |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,027
|
case in point,
good call on sumproduct, Dave. |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
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 |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
|
|
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Apr 2002
Posts: 91
|
tHANKS!!!!!!!
|
|
|
|
|
|
#9 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
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 |
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Apr 2002
Posts: 91
|
OH, AND thanks for not pointing out or making fun of the fact that I don't know how to add!
dawn |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|