Conditional Sums? (1 Viewer)

AC5FF

Registered User.
Local time
Today, 02:23
Joined
Apr 6, 2004
Messages
552
I really should know the answer to this; but I cannot for the life of me get things to work! Hopefully someone here will know the answer and give me a virtual slap across the face! :D

I have two columns of data here: One is location (DAV/REW/OTHER) the second is an amount (Dollar Figure). What I want to do is sum all the amounts if it is a DAV amount. Likewize I'll need to do the same with REW and OTHER amounts, but just getting the first one to work will let me know how to do the others...

I tried to use the VLOOKUP function, but it will only return the first line that it finds with "DAV". Any other ideas?

Sample of data:
DAV...$2
DAV...$3
REW...$2
DAV...$9
OTHER...$8
REW...$2
DAV...$3

THANKS!
 

MSAccessRookie

AWF VIP
Local time
Today, 03:23
Joined
May 2, 2008
Messages
3,428
I really should know the answer to this; but I cannot for the life of me get things to work! Hopefully someone here will know the answer and give me a virtual slap across the face! :D

I have two columns of data here: One is location (DAV/REW/OTHER) the second is an amount (Dollar Figure). What I want to do is sum all the amounts if it is a DAV amount. Likewize I'll need to do the same with REW and OTHER amounts, but just getting the first one to work will let me know how to do the others...

I tried to use the VLOOKUP function, but it will only return the first line that it finds with "DAV". Any other ideas?

Sample of data:
DAV...$2
DAV...$3
REW...$2
DAV...$9
OTHER...$8
REW...$2
DAV...$3

THANKS!


I would think that SUM() and GROUP BY would work here.
Code:
[B]SELECT[/B] TheTable.ItemType, [B][COLOR=#00bfff]SUM([/COLOR][/B]TheTable.ItemCost[B][COLOR=#00bfff])[/COLOR][/B]
[B]FROM[/B] TheTable
[COLOR=deepskyblue][B]GROUP BY[/B][/COLOR] TheTable.ItemType;

Methinks I need to be more observant. This is an Excel Issue, not an Access one. I need more Coffee.
 
Last edited:

Mike375

Registered User.
Local time
Today, 17:23
Joined
Aug 28, 2008
Messages
2,548
This might be what you want as I posted up what was similar to your question. The poster who answered was also on this forum but I don't think he is around anymore. He was real Exc el whiz kid:D

This is a link to a thread I started on dbForums

http://www.dbforums.com/showthread.php?t=1626947

I think the attached Excel file (in that thread) should still work, if not I have it here somewhere.
 

Mike375

Registered User.
Local time
Today, 17:23
Joined
Aug 28, 2008
Messages
2,548
PS,

I just found the Excel file where I did it. On Sheet 4 and referencing Sheet 1.

My one glorious moment in Excel:D
 

Attachments

  • PriceListOctoberWith SUMIF.zip
    16.9 KB · Views: 152

AC5FF

Registered User.
Local time
Today, 02:23
Joined
Apr 6, 2004
Messages
552
MSAccessRookie: I either am not fully understanding you here or you mis-understood my question. Your reply looks like it would work in Access; but not Excel (I could very well be wrong here!) If I had this in Access I don't think it would have been a problem; but since it is an Excel spreadsheet... Just giving me fits :)

Mike375: Thank You! You can virtually slap me across the face! :D
SUMIF(range,criteria,sum-range) DUHHHH!!!! :rolleyes: I totally spaced that one! I was trying a SUM(IF(VLOOKUP(..............))) and just digging a hole deeper and deeper. Your link fixed it all right up for me! Thanks!
 

MSAccessRookie

AWF VIP
Local time
Today, 03:23
Joined
May 2, 2008
Messages
3,428
MSAccessRookie: I either am not fully understanding you here or you mis-understood my question. Your reply looks like it would work in Access; but not Excel (I could very well be wrong here!) If I had this in Access I don't think it would have been a problem; but since it is an Excel spreadsheet... Just giving me fits :)

Mike375: Thank You! You can virtually slap me across the face! :D
SUMIF(range,criteria,sum-range) DUHHHH!!!! :rolleyes: I totally spaced that one! I was trying a SUM(IF(VLOOKUP(..............))) and just digging a hole deeper and deeper. Your link fixed it all right up for me! Thanks!

Yes, it works for Access and not for Excel. I already spanked myself for not reading well enough.
 

shades

Registered User.
Local time
Today, 02:23
Joined
Mar 25, 2002
Messages
516
A solution from almost a year ago. Wow, the last time I was called a "kid" was about a half century ago. :D

You are right, Mike. I seldom get by here with my new position (seminary president). But occasionally I miss the old crowd and peek in to see what is going on.
 

Users who are viewing this thread

Top Bottom