Thread: Sumif using or
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default Sumif using or

Since the account numbers are distinct you can use

=SUMPRODUCT((A2:A10={1,3,4})*(B2:B10))

will sum accounts 1,3 and 4 in B2:B10 (May)
if you want to copy across to get the sum for June use

=SUMPRODUCT(($A$2:$A$10={1,3,4})*(B2:B10))

--

Regards,

Peo Sjoblom

Northwest Excel Solutions

www.nwexcelsolutions.com

(remove ^^ from email address)

Portland, Oregon




wrote in message
oups.com...
Data that looks like this

Account May June July ...
1 $10 $15 $22 ...
2 $12 $8 $34...
...

Each account number is distinct (no duplicates)

I want a forumula to give me the sum of certain accounts for may.

I can use sumif(a2:a200,1,b2:b200)+sumif(a2:a200,2,b2:b200) to get
totals of account 1 and 2 for may but what if I wanted to sum 10
accounts for may that would be a really big formula... there must be a
better way.

Something like sumif(a2:a200,or(1,2,3,4,etc),b2:b200) which excel
doesnt allow.

Seems to me that vlookup with an array would work but I cant get it to
sum the results.

Thanks for any help
Gary