PDA

View Full Version : Sum If Same Row in data table contains criteria



ThePigeon
05-30-2009, 03:11 PM
Hey

I know I should probably be able to work this out..... but I’ve tried for about an hour and I’ve failed..... so if some one help we out it would much appreciated.

Just to clarify what I’m trying to do:

I’ve got a Data Table (one I’m using to test and work it out):
http://i412.photobucket.com/albums/pp202/JoeDrane/Capture.jpg
What I want to do is make so the total (c7) is automatically made to be the sum of “cost” (column: C) values in the rows which have a “y” in the “use” column (column: D). if somebody could show me a way to do this would be great.

One quick thing…. don’t want to be picky but I would prefer it someone could give me a solution with “vba” as I would like to use it with a userform, custom dialog or activeX object. Although I will be quite happy with a formula solution as it will work fine in short term.

Thanks for ant help,
Regards,
Joe

mdmackillop
05-30-2009, 03:41 PM
Hi Joe
=SUMIF(D$2: D6,"y",C$2:C6)

For VBA I would use the same formula in the code, or use the code to enter the formula in the designated cell.
Regards
MD

ThePigeon
05-30-2009, 03:57 PM
dam was staring right in the face!

lol i need to get some mroe sleep :P

works a treat.
thanks mdmackillop for the 2nd time today

thxs,
joe