+ Reply to Thread
Results 1 to 9 of 9

How to Subtotal with Text Criteria

  1. #1
    Registered User
    Join Date
    03-15-2024
    Location
    SoCal
    MS-Off Ver
    Excel for Mac Ver 16.83
    Posts
    4

    How to Subtotal with Text Criteria

    Update. I have attached the sample Excel file and added a little more detail to my question. Thanks again!

    Apologies, I've searched the forums, but can't find the exact answer.

    Here is the problem I have. I would like to subtotal values from Column C, when a filter is applied to either Column A or B or both. Right now, I am only able to calculate the total even when the filter is applied.

    For example, if I filter Column A (Year) for "2023", then my expected result is E1 = $60,000 and E2 = $12,000 or if I filter Column B only (Expense) for "Travel", then E2 = $27,000.

    Attachment 862910

    Screenshot 2024-03-14 at 11.05.51 PM.png

    Thank you in advance for your advice.
    Attached Files Attached Files
    Last edited by LugoonaLBC; 03-15-2024 at 11:09 AM. Reason: Added Excel File.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,767

    Re: How to Subtotal with Text Criteria

    Welcome to the forum.

    Is that a 365 version of Excel for Mac?

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: How to Subtotal with Text Criteria

    One way (assuming 16.83 is an up to date version of O365), avoiding the use of the volatile OFFSET function:

    =SUM(FILTER(C5:C8,(B5:B8=E1)*(MAP(A5:A8,LAMBDA(z,AGGREGATE(3,7,z)))=1)))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    03-15-2024
    Location
    SoCal
    MS-Off Ver
    Excel for Mac Ver 16.83
    Posts
    4

    Re: How to Subtotal with Text Criteria

    Thank you for the guidance. I have added a sample Excel file.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: How to Subtotal with Text Criteria

    It didn't attach properly. Refer to Post 3.

  6. #6
    Registered User
    Join Date
    03-15-2024
    Location
    SoCal
    MS-Off Ver
    Excel for Mac Ver 16.83
    Posts
    4

    Re: How to Subtotal with Text Criteria

    Thanks Glenn! Your solution works.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: How to Subtotal with Text Criteria

    You're welcome. Thanks for letting us know that you got an answer.




    Please take a moment and consider clicking the "Add Reputation" button at the foot of any of the posts of anyone who helped you reach a solution here today.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  8. #8
    Registered User
    Join Date
    03-15-2024
    Location
    SoCal
    MS-Off Ver
    Excel for Mac Ver 16.83
    Posts
    4

    Re: How to Subtotal with Text Criteria

    Related to my first question, I would like to count the number of occurrences from the filter.

    Specifically, if I filtered Column A (Year)for "2023", then C1 should result in 1. It currently shows the total count for all years.
    Attached Files Attached Files

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: How to Subtotal with Text Criteria

    It's a bit hard to follow what you want with such a tiny sample.... 10-20 rows is normally ideal, but try:

    =ROWS(FILTER(C6:C11,(B6:B11=D1)*(MAP(A6:A11,LAMBDA(z,AGGREGATE(3,7,z)))=1)))

    and set format as general.

+ 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. Subtotal function with Criteria
    By jharvey87 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-22-2021, 04:59 PM
  2. Subtotal to count 2 criteria.
    By liamfrancis2013 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-12-2017, 06:12 AM
  3. [SOLVED] How to Subtotal Countifs with 3 criteria?
    By ExcelFledgling in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-03-2015, 03:53 PM
  4. Subtotal - Delete zero Subtotal and prior rows that calculate to that zero Subtotal
    By Whatsherface in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2012, 08:37 PM
  5. SubTotal function. How do I keep reuse Subtotal criteria.
    By davidthegolfer in forum Excel General
    Replies: 0
    Last Post: 10-10-2006, 03:28 AM
  6. Get subtotal by two criteria
    By sean_f in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2006, 12:15 PM
  7. SUBTOTAL and then count with criteria
    By Jane in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-13-2005, 03:07 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