Thread: Help with SUMIF
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
sumitk
 
Posts: n/a
Default Help with SUMIF

Thanks Paul & Jim. I think I finally have this working.

Regards,
Sumit

"PaulW" wrote:

in B6 enter =sumif($A$2:$A$4,"Cat",B2:B4)


Row/Col. A B C D
1 Animal/Color White Black Brown
2 Cat 5 10 15
3 Dog 20 25 30
4 Cat 35 40 45


=sumif($A$2:A$4,"Cat",B2:B4)

Will work in the current table. If White is going to move, put something in
to search for "White", what I do is =match("White",1:1,0) which in this case
will return 2. I know its not ideal, but I then have a little table with a
Column as the numbers counting, and another as Letters running. Then do a
Vlookup of this Match, so that 2 becomes B.

Say this vlookup graph is in A50:B100, then =vlookup(2,A50:B100,2,FALSE)
Adding the match into this it becomes,
=vlookup(match("White",1:1,0),A50:B100,2,FALSE)
Concatenate will change this to
=concatenate(vlookup(match("White",1:1,0),A50:B100 ,2,FALSE),":",vlookup(match("White",1:1,0),A50:B10 0,2,FALSE))
Which in this case will return B:B

Using indirect to use this
sumif($A$2:A$4,"Cat",indirect(concatenate(vlookup( match("White",1:1,0),$A$50:$B$100,2,FALSE),":",vlo okup(match("White",1:1,0),$A$50:$B$100,2,FALSE))))

If you wanted these results to be in say G1, you could put White in H1,
Black in I1 and Brown in J1, in G2 put "Cat" and in G3 put "Dog". Copy the
above formula into H1, and change the Cat and Whites to cell references, so
it ends up as

=sumif($A$2:A$4,$G2,indirect(concatenate(vlookup(m atch(H$1,1:1,0),$A$50:$B$100,2,FALSE),":",vlookup( match(H$1,1:1,0),$A$50:$B$100,2,FALSE))))

You can then drag this formula into the other cells for this summary.

Even if this isn't exactly what you want, hopefully it'll help you get there
:)