Results 1 to 2 of 2

Thread: How to write a Countif then Sum?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Posts
    5

    How to write a Countif then Sum?

    I would like to write a formula that will sum a range if each cell meets a certain criteria. For example: Range A1:A20 = different prices. Range B1:B20 = Apples or Oranges. I need a single cell to compute the sum of Range A1:A20 if the cell next to it is either apple or orange.

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: How to write a Countif then Sum?

    Use 2 SUMIF() or use SUMPRODUCT():
    Code:
    =SUMIF(B1:B20,"Apple",A1:A20)+SUMIF(B1:B20,"Orange",A1:A20)
    or
    =SUMPRODUCT(((B1:B20="Apple")+(B1:B20="Orange"))*(A1:A20))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width