+ Reply to Thread
Results 1 to 9 of 9

sum based on conditions

  1. #1
    Registered User
    Join Date
    03-22-2017
    Location
    London
    MS-Off Ver
    Microsoft Office 2016
    Posts
    9

    sum based on conditions

    Hi all,

    Sorry I'm fairly new to excel and not very good at formulas.

    I have two columns. Column A has a list of three data sets, for example, SOY, RICE, BEAN. Column B has a list of names, for example John, Mark, David.

    I want to use a formula that will scan both columns and, based on column B, find their choices in column A and add it up to a total. For example, I want to find all the instances where John has chosen RICE and get the formula to add that up for me automatically, so the result I get is something like John = 56 RICE.

    Is it a SUM formula with either CountIF or V or H Lookup? I can't figure out how to do this.

    Best,

    Pailong.

  2. #2
    Forum Contributor
    Join Date
    01-05-2017
    Location
    New York
    MS-Off Ver
    Office 2016
    Posts
    206

    Re: sum based on conditions

    Try this:

    =COUNTIFS(B:B,"JOHN",A:A,"RICE")

    And then change it up for different people, foods, etc.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: sum based on conditions

    Welcome to the forums!

    The function you need to look at is COUNTIFS:

    =COUNTIFS(B:B,"John",A:A,"Rice")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    03-22-2017
    Location
    London
    MS-Off Ver
    Microsoft Office 2016
    Posts
    9

    Re: sum based on conditions

    Ah of course! It was CountIFS! It worked! Thanks very much.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: sum based on conditions

    You're welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Registered User
    Join Date
    03-22-2017
    Location
    London
    MS-Off Ver
    Microsoft Office 2016
    Posts
    9

    Re: sum based on conditions

    I do have one more question:

    What if I needed my count to be dependent on several criteria in column A?

    For example, if I wanted excel to count how many instances John (column B) has chosen RICE, BEAN (column A) i.e. more than just one choice in column A, how would I do that? Would it be CountIFS again?

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: sum based on conditions

    Maybe something like this...

    =SUM(COUNTIFS(B:B,"John",A:A,{"Rice","Bean"}))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Registered User
    Join Date
    03-22-2017
    Location
    London
    MS-Off Ver
    Microsoft Office 2016
    Posts
    9

    Re: sum based on conditions

    Thanks very much!

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: sum based on conditions

    You're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 01-14-2016, 03:53 PM
  2. [SOLVED] Get top ten based on two conditions
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-17-2015, 08:11 AM
  3. calculation using reference to cells based on conditions
    By shrimic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2012, 12:32 PM
  4. Look up based on two conditions
    By floricita in forum Excel General
    Replies: 5
    Last Post: 05-20-2011, 08:56 AM
  5. Looking up a value based on 2 conditions
    By gico1972 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-14-2007, 09:06 AM
  6. Counting based upon 2 conditions that are text based
    By walkerdayle in forum Excel General
    Replies: 7
    Last Post: 08-21-2006, 08:35 PM
  7. Sum based on two conditions
    By luvgreen in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-10-2006, 03:29 AM

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