View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default SUMIF of adjacent variable cells

michael - i know what you want but i can't get my head around it
either, as to how to DO it.
i'm thinking your offset value idea would work, but i don't know if a
variable will hold a sum that keeps changing.......
i was waiting to see somebody more experienced than me answer it! :)
you could try something like this UNTESTED PSEUDOCODE:

sub michael()

dim myVar as variant 'might need to be integer
dim my2ndVar as variant 'same
dim rProducts as range
dim cell as range

set rProducts= whatever
set myVar = 0
for each cell in rproducts
if cell.text= "boxes" then
set my2ndVar as offset(0,-1).value
myvar = myvar + my2ndvar
end if
next cell

end sub

maybe this helps?
:)
susan


On Mar 27, 10:32 am, "michaelberrier"
wrote:
Don,
Thanks for looking. This only tells me how many times that word shows
up in the list. I would like to add the numbers adjacent to that word
as they represent a quantity. I'm thinking an Offset would work as
the quantity is always the cell to the left of the value, but I'm not
sure how to write that.

On Mar 27, 10:11 am, "Don Guillett" wrote:



to count bags where f6 contains "bags"
=COUNTIF(Sheet12!A:F,F6)


--
Don Guillett
SalesAid Software
"michaelberrier" wrote in message


roups.com...


There are several lists of items in the range D3:F31. In the same
range, beside the items are quantities, like so


5 Bags
3 Boxes
2 Carts etc,


Many of the items are duplicated throughout the multiple lists, so I'd
like a total quantity of each item. I've copied all the items to a
master list, but I'm stumped on the function to pull the individual
values out of each list for each item...I'm guessing it's a SUMIF, but
I'm not sure how to make it work.


Thanks in advance.- Hide quoted text -


- Show quoted text -