+ Reply to Thread
Results 1 to 11 of 11

Calculate totals with an IF statement

  1. #1
    Registered User
    Join Date
    11-08-2006
    Posts
    3

    Calculate totals with an IF statement

    I need to know how to calculate totals from a spreadsheet in conjunction with an IF statement.
    I have a columns A & B below, i would like to calculate the numbers in coulmn B only if they match a specific criteria in column A.
    For example: I want calculate the total of the numbers in coulmn 'B' only if column A is a '1'.

    A B
    2 4
    3 3
    1 2
    2 1
    3 5
    1 3
    2 2

    I would appreciate any help that could be offered.

    Thanks

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    You need an array formula i.e Control Shift Enter instead of Enter

    Please Login or Register  to view this content.
    HTH
    Carim

  3. #3
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Glad your problem's fixed.

    Thanks for the feedback

    Carim

  4. #4
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    non-cse method

    =SUMIF(A2:A8,1,B2:B8)
    --Mark

    Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

  5. #5
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Mark you are right ...
    I am getting completely distorted ... !!!

    Cheers
    Carim

  6. #6
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    oh nothing wrong with your solution Carim, just throwing another option out there as CSE formulas are somewhat intimidating at first

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    You are right ...
    Your solution is far better AND much easier to understand ... !!!

    Cheers
    Carim

  8. #8
    Registered User
    Join Date
    11-08-2006
    Posts
    3

    Another question if i may?

    Could i add another column into the query, say another column similar to A that i would want to match up as follows.
    If there is a 1 in column A and a 1 in column B, then add the numbers in column C?

  9. #9
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by acrookes
    Could i add another column into the query, say another column similar to A that i would want to match up as follows.
    If there is a 1 in column A and a 1 in column B, then add the numbers in column C?
    Try:
    =SUMPRODUCT(--(A2:A8=1),--(B2:B8=1),C2:C8)

    Sumproduct generally works better if you have more than one condition.

    Scott

  10. #10
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Yes,

    You can add as many columns and criteria as you wish with text or numbers ...

    But you will have to move to THE formula ...
    Sumproduct()

    Why don't you fully analyze your requirements and then post all the deatils of your request ...

    HTH
    Carim

  11. #11
    Registered User
    Join Date
    11-08-2006
    Posts
    3

    Thanks everyone

    Thanks for all of the help, and sorry for the late add on.
    I am all done now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1