sumif

snjpverma

Well-known Member
Joined
Oct 2, 2008
Messages
1,585
Office Version
  1. 365
Platform
  1. Windows
i have a names in column A and numbers in column B. Now i want to get the total of john. Then I put the below formula
=SUMIF(A:A,"john",B:B)
This gives my solution. But when I want the total of two or more people. Then it's a problem.
I am trying it like this.
=SUMIF(A:A,"john",B:B)+SUMIF(A:A,"mark",B:B)+SUMIF(A:A,"john",B:B)
This seems to be quite long because i have to put the whole formula again and select the same ranges again. Is there any short formula for this.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Excel Workbook
ABCDEF
1NamesAmount1,000.00
2John240.00Criteria >JohnMark1,000.00
3Bill280.00
4Mark320.00
5Jane360.00
6Kristi400.00
7John440.00
1a
Excel 2003
Cell Formulas
RangeFormula
F1=SUM(SUMIF($A$2:$A$10,{"John","Mark"},B$2:B$10))
F2=SUMPRODUCT(SUMIF(A2:A10,D2:E2,B2:B10))


try either of the formulas above

N.B. The Criteria is in D2 and E2
 
Upvote 0
i have a names in column A and numbers in column B. Now i want to get the total of john. Then I put the below formula
=SUMIF(A:A,"john",B:B)
This gives my solution. But when I want the total of two or more people. Then it's a problem.
I am trying it like this.
=SUMIF(A:A,"john",B:B)+SUMIF(A:A,"mark",B:B)+SUMIF(A:A,"john",B:B)
This seems to be quite long because i have to put the whole formula again and select the same ranges again. Is there any short formula for this.
Here's another one...

Book1
ABCD
1NameValue
2Bill89Tom
3Tom13Sue
4Sue91Biff
5Bill50
6Bill86
7Tom16
8Sue88
9Sue79
10Sue36
11Lisa66
12Janet59
13Biff59
14Biff80
15Carl2
Sheet1

To get the sum for Tom, Sue and Biff...

=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A15,D2:D4,0))),B2:B15)
 
Upvote 0
Both the replies are wonderful. thanks so much. But sorry that I forgot to add one thing. I have the dates in column C so if I want the to calculate the data only for a particular date. I mean to say, for example the sum for john and mark only for 4th april' 2011.
 
Upvote 0
Excel Workbook
ABCDEFGHI
1NamesGroupAmountDateCriteria >AApr 04, 20111,200.00
2JohnA240.00Apr 01, 2011Criteria >JohnMark1,200.00
3BillB280.00Apr 02, 20111,200.00
4MarkA320.00Apr 04, 2011
5JaneB360.00Apr 04, 2011Sum of AmountGroup
6KristiB400.00Apr 04, 2011DateABGrand Total
7JohnA440.00Apr 04, 2011Apr 01, 2011240.00240.00
8JaneB360.00Apr 04, 2011Apr 02, 2011280.00280.00
9KristiB400.00Apr 04, 2011Apr 04, 20111,200.001,880.003,080.00
10JohnA440.00Apr 04, 2011Apr 05, 2011440.001,160.001,600.00
11JaneB360.00Apr 04, 2011Grand Total1,880.003,320.005,200.00
12KristiB400.00Apr 05, 2011
13JohnA440.00Apr 05, 2011
14JaneB360.00Apr 05, 2011
15KristiB400.00Apr 05, 2011
16
1aa
Excel 2003
Cell Formulas
RangeFormula
H1=SUMPRODUCT(--(B2:B15=F1),--(D2:D15=G1),(C2:C15))
H2=SUMPRODUCT(--((A2:A15=F2)+(A2:A15=G2)),--(D2:D15=G1),(C2:C15))
H3=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A15,F2:G2,0))),--(D2:D15=G1),(C2:C15))


I inserted a Column for the Group information that I used in one formula and the Pivot table.

You may want to experiment with Pivot Tables.
 
Upvote 0
Both the replies are wonderful. thanks so much. But sorry that I forgot to add one thing. I have the dates in column C so if I want the to calculate the data only for a particular date. I mean to say, for example the sum for john and mark only for 4th april' 2011.
Try this...

Book1
ABCDE
1NameValueDateCriteria
2Bill894/1/2011John
3John134/4/2011Mark
4Sue914/4/20114/4/2011
5Mark504/3/2011
6Mark864/4/2011
7Tom164/6/2011
8John884/4/2011
9John794/4/2011
10Sue364/3/2011
11Mark664/1/2011
12Janet594/8/2011
13Biff594/8/2011
14Biff804/6/2011
15John24/3/2011
Sheet1

=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A15,E2:E3,0))),--(C2:C15=E4),B2:B15)
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,310
Members
452,906
Latest member
phanmemchatdakenhupviral

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