Referred from- http://www.excelforum.com/excel-gene...-criteria.html

I want to add formula in G4 to add values from cell range D424
where Text of C4:C24 matches with G3 and
Number of cell summed should be upto C1.(Means if c1 is 4 should add first 4 values only)
Please see Image for explanation.

Right now I am using
=SUMIF(b4:OFFSET($b4,4*($C$1-1),,,),G3,$C$4:$c$24)
Click image for larger version. 

Name:	tt.JPG 
Views:	8 
Size:	49.8 KB 
ID:	1999