Code for SUM with duel criteria
set rng = Range(Cells(1,3),Cells(rows.count,3).end(xlup))
for each cell in rng
if cell.offset(0,-2) < myDate and cell.Offset(0,-1).value = myItemNo then
if isnumeric(cell) then
mytotal = myTotal + cell.Value
End if
end if
Next
if a worksheet formula
=Sumproduct(-(A1:A100<F1),-(B1:B100=G1),C1:C100)
F1 contains the date
G1 contains the item number
--
Regards,
Tom Ogilvy
"Shetty" wrote in message
om...
Greetings,
I need to write the code for the sum with criteria of two different
columns.
Say for example, Col A has Date, Col B has item no and col C has a
value to be summed up. I have an input box for the date and item no.
What I need to do is to lookup for date less the date of input, item
no equall to item no of input in the same row and if both are matching
then sum the value.
I can do it for one criteria but not for the two criteria.
Request help please.
Regards,
Shetty.
|