+ Reply to Thread
Results 1 to 4 of 4

Need array to sum based on multiple criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    08-19-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2010
    Posts
    6

    Need array to sum based on multiple criteria

    Hello,

    [SEE REPLY POST BELOW FOR UPDATED FILE]

    Basically I need an array that will sum up one column based on criteria from others.

    Below is a snip of a super simplified version of what I've got:

    Capture.PNG

    Now if it loaded correctly there should be 4 columns. I need an array that will sum up the total items in store for the first instance of a store, But I want it summed by state. So without a formula, I want to sum total Items in store for NY. I only want the first instance of each store in NY which would be the sum of 220 and 75. This is where I want to end. Keep in mind this is overly simplified and my actual table is tens of thousands of rows.

    I think I'm close with this formula but can't get it to work correctly.
    {=IF(COUNTIFS(C:C,"NY",INDEX(A:A,MATCH(A:A,A:A,0)):A:A,A:A)=1,SUM(INDEX(D:D,MATCH(A:A,A:A,0)):A:A,A:A),"0")}


    Any help would be greatly appreciated.
    Attached Images Attached Images
    Last edited by Joshua H; 08-19-2016 at 02:15 PM.

  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. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,703

    Re: Need array to sum based on multiple criteria

    Welcome! Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    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
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Need array to sum based on multiple criteria

    Hi
    Your output is not so clear to me. Please upload an excel worksheet with input and expected output result

    Any way you can use sumifs or sumproduct for more than one criteria. if first item is always eggs as in your data you can use

    Syntax
    sumifs(sum_range, criteria_rabge1, criteria1, criteria_rabge2, criteria2, .....

    =sumifs(d2:d17,c2:c17,"NY",b2:b18,"eggs")
    =sumproduct((c2:c17="NY")*(b2:b17="eggs")*(d2:d17))
    Regards
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

  4. #4
    Registered User
    Join Date
    08-19-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2010
    Posts
    6

    Re: Need array to sum based on multiple criteria

    Here is a more similar book to that which I am actually using.

    You can see the ultimate goal is to get a table that will give me my store count by state as well as by size.
    State can be found in column D but size is the 4th and 5th digit in column A.
    I want to know how many stores are below 20 equal to 20 and above 20 for each state.
    To get the numbers I have now I added the three columns highlighted in red.
    However my ultimate goal would be to have one formula doing all the work instead of additional columns.

    Attached is the excel file if you need any other information I'd be happy to provide.

    if anyone can help it would mean alot

    keep in mind I only want to add up the first instance of each section because in my full workbook each section can appear more than 100 times and I only want it counted once.
    Attached Files Attached Files
    Last edited by Joshua H; 08-19-2016 at 01:55 PM.

+ 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. Sum array (or something) based on multiple criteria
    By VBA-NOOB in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-25-2015, 05:02 PM
  2. Array that pulls list of data based on sum of multiple criteria
    By moses125 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-19-2015, 06:14 PM
  3. Array formula to return multiple values based on various (OR) criteria
    By dancing-shadow in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-20-2013, 05:12 AM
  4. Multiply based on multiple array criteria
    By jcullen in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-21-2012, 06:14 PM
  5. Return array based on multiple criteria
    By kmacd in forum Excel General
    Replies: 3
    Last Post: 01-05-2011, 09:05 PM
  6. Replies: 4
    Last Post: 04-16-2010, 10:09 AM
  7. Using array to sum by multiple criteria including one based on prefix
    By monkdelafunk in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-29-2008, 02:24 PM

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