If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > newbie: sum only for the numbers of sunday

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-15-05, 04:49
cuongvt cuongvt is offline
Registered User
 
Join Date: May 2004
Posts: 133
newbie: sum only for the numbers of sunday

My spreadsheet is as follow:
First row:
a1 is sun
a2 is mon
a3 is tue
and so on etc

second row is numbers:
b1 is 1.4
b2 is 13
and so on
My question is how can I sum the second row for the numbers which have cell in first row is sun only.
Please help me. I need your help. Many thanks
Reply With Quote
  #2 (permalink)  
Old 02-15-05, 07:05
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
For this example i would use a SUMIF

something like this

=SUMIF(A1:A3,"sun",B1:B3)
have a look at the help file for more information
Reply With Quote
  #3 (permalink)  
Old 02-15-05, 09:24
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
SUMIF works great for one condition. If you have multiple conditions, use SUMPRODUCT

=SUMPRODUCT(($A$1:$A$10="sun")*($B$1:$B$10="East") *($C$1:$C$10="First Qtr"),$D$1:$D$10)

This will look at only those on sun in column A, which also has only items for East in column B, and First Qtr for column C, then sums up those values in column D.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #4 (permalink)  
Old 02-15-05, 09:43
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
For the sake of total accuracy you should use -- as well in your sumproduct

i.e.

=SUMPRODUCT(--(A1:A3="sun"))
will work for a count but
=SUMPRODUCT((A1:A3="sun"))
wont

this is only needed for single arrays rather than in the above example
as Boolean multiplication does lead to integers
Reply With Quote
  #5 (permalink)  
Old 02-15-05, 11:18
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Good point, but that is also why I don't use SUMPRODUCT on single arrays.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #6 (permalink)  
Old 02-15-05, 11:27
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
I cant believe im making comments on the man who i leant to use this function from in the first place,
i use -- just to make sure im not going to get any errors, and i thought i should point it out, in case cuongvt asks why the SUMPRODUCT function isnt working
Reply With Quote
  #7 (permalink)  
Old 02-15-05, 12:51
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091


In my old age, I tend to get sloppy! Thanks for the reminders.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On