Closed Thread
Results 1 to 28 of 28

SUMIF function with multiple criteria from a data list to get orders and returns!

  1. #1
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    SUMIF function with multiple criteria from a data list to get orders and returns!

    This is continuing post from: excelforum.com/excel-formulas-and-functions/1420319-sumif-fuctioin-with-mutliple-criterias-from-a-data-list-new-post.html

    I made some mistakes there like going over the 20-line data limit and not puting in the solution I was looking for! I posted it from JPRICH16 but cant access that account so made a new one! sorry for the long explanation!!

    Below is the exact post (new excel attachment)

    "Hi Everyone,

    I need returns and orders from a specific customer.

    Orders is easy its: =SUMIFS(Data!$G:$G,Data!$D:$D,"Order",Data!$J:$J,Sheet2!$I$6,Data!$V:$V,">10/1/2023")

    So returns should be: =SUMIFS(Data!$G:$G,Data!$D:$D,"Return",Data!$J:$J,Sheet2!$I$6,Data!$V:$V,">10/1/2023")

    BUT

    A return can only be true IF the serial number being returned has been ORDERED AFTER the start date, in this case, 10/1/2023.

    Since the data can go back YEARS, i need to a formula search all return serial numbers that have an order date that is after the start date And had the same serial number.....or its overstated and wrong

    i cant figure it out!!!!"
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    02-29-2024
    Location
    EGYPT - Cairo
    MS-Off Ver
    MS365
    Posts
    91

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Quote Originally Posted by jrich16 View Post
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    So returns should be:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    What or where is Sheet2! that was mentioned in the formulas? Is it Data

    Also, according to the Data sheet, there are 4 entries for Return, which is not going with the result you want.
    Last edited by MohamedGadAllah; 03-01-2024 at 03:09 AM.
    Thank,
    Mohamed GadAllah

  3. #3
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Sheet2! is no there

  4. #4
    Registered User
    Join Date
    02-29-2024
    Location
    EGYPT - Cairo
    MS-Off Ver
    MS365
    Posts
    91

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Quote Originally Posted by azumi View Post
    Sheet2! is no there
    I am afraid that I do not understand, you mean it does not exist?

  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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    1. Why have you created a new account?
    2. Please fill in your Excel version in your new account.

    You said that this formula works: =SUMIFS(Data!$G:$G,Data!$D:$D,"Order",Data!$J:$J,A6,Data!$V:$V,"=>10/1/2023"). It returns 0, but your expected result is 6. This is because none of the dates in your workbook are real dates - they are text.
    Last edited by AliGW; 03-01-2024 at 03:44 AM.
    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.

  6. #6
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Try this:

    =SUMPRODUCT((Data!D:D="Order")*(Data!J:J=A6)*IFERROR((Data!V:V+0>=C6+0),1),Data!G:G)

    and this:

    =SUMPRODUCT((Data!D:D="Return")*(Data!J:J=A6)*IFERROR((Data!V:V+0>=C6+0),1),Data!G:G)

    There are 4 returns that meet the criteria, bu the way, not just 1.

    EXCEPT NEED TO REMOVE ANY SERIALS NUMBERS THAT HAS AN ORDER (Z5LF) BEFORE THE START DATE OF 10/1/2023
    There is no ZSLF anywhere in the sample workbook that I can see.
    Attached Files Attached Files

  7. #7
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,249

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    In your data sheet date are text. Convert into date format.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  8. #8
    Registered User
    Join Date
    02-29-2024
    Location
    EGYPT - Cairo
    MS-Off Ver
    MS365
    Posts
    91

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    In D4 in Need Help sheet for Orders:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Result is 6.

    In E4 in Need Help sheet for Returns:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Result is 4.


    In E6 in the Need Help sheet you typed 1, is this by mistake, or it is the result you are looking for? or this due to the note you mentioned
    EXCEPT NEED TO REMOVE ANY SERIALS NUMBERS THAT HAS AN ORDER (Z5LF) BEFORE THE START DATE OF 10/1/2023
    Also, what is the meaning of the (Z5LF)?

  9. #9
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Hi,

    First of all thank you so much for helping me on: excelforum.com/excel-formulas-and-functions/1420354-sumif-function-with-multiple-criteria-from-a-data-list-to-get-orders-and-returns.html#post5926502

    thank you SO MUCH THIS WORKS but it fails when looking at the "order" dates for the first 2 line items which affect the return date as well for the third line item and last line item

    but

    Here are the 4 items that would not be included in the summary tab/results:

    1. first order on the data list is 10/1/2022 =- before the start date
    2. second order on the data list is before start date
    3. first return is dated after the start date BUT is for an order that occurred before the start date, serial number 1
    4. the last line item is for return with serial number "0", which is for an order before the start date

    therefore the results should not include 2 returns and 2 orders since all orders must occur after the start date of 10/1/2023 AND for returns, the returns must be for a serial number order that occurred after the start date too

    so orders must be 6 and returns must be 2

    THIS IS WHY ITS SO HARD BUT THANK YOU SO MUCH FOR TRYING TO HELP, I APPRECIATE IT!
    Attached Files Attached Files
    Last edited by jrich16; 03-01-2024 at 10:06 AM. Reason: adding more info

  10. #10
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    @MohamedGadAllah

    THANK SO MUCH FOR TAKING THE TIME TO HELP ME.

    PLEASE SEE MY RESPONSE BELOW TO EVERYONE.

    THE RESULTS IS; orders = 6 and returns = 2 because results should not include 2 returns and 2 orders since all orders must occur after the start date of 10/1/2023 AND for returns, the returns must be for a serial number order that occurred after the start date too
    Last edited by AliGW; 03-01-2024 at 10:41 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  11. #11
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    @AliGW

    Thank you for your response, I dont think I communicated the problem enough for your advice im sure you would of solved it perfectly if i did better in my post. thank you again, you're awesome!!
    Last edited by AliGW; 03-01-2024 at 10:41 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  12. #12
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Please update your forum profile with your Excel version - this is very important. Find out what it is, please.
    Attached Images Attached Images

  13. #13
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Does this do what you want?

    =D6-SUMPRODUCT((Data!D:D="Return")*(Data!J:J=A6)*IFERROR((Data!V:V+0>=C6+0),1),Data!G:G)

    Please test it thoroughly.

  14. #14
    Registered User
    Join Date
    02-29-2024
    Location
    EGYPT - Cairo
    MS-Off Ver
    MS365
    Posts
    91

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Hi jrich16
    Please correct me if I am wrong, you only want to count the return that its order serial number happened after the start date.
    I've used the data you provided in 1st post and resorted according to the serial number.
    I've used the following sample from your data

    Excel 2016 (Windows) 64 bit
    A
    B
    C
    D
    E
    F
    G
    H
    1
    Serial number Type Delivery quantity Customer # Created on
    2
    0
    Order
    1
    674700
    10/1/2022
    3
    0
    Return
    1
    674700
    10/1/2023
    1
    OUT because order date is before start date
    4
    1
    Order
    1
    674700
    10/1/2022
    5
    1
    Return
    1
    674700
    10/1/2023
    1
    OUT because order date is before start date
    6
    2
    Order
    1
    674700
    10/1/2023
    7
    2
    Return
    1
    674700
    10/1/2023
    1
    IN because order date is after start date
    8
    3
    Order
    1
    674700
    10/1/2023
    9
    3
    Return
    1
    674700
    10/1/2023
    1
    IN because order date is after start date
    10
    4
    Order
    1
    674700
    10/1/2023
    11
    5
    Order
    1
    674700
    10/1/2023
    12
    6
    Order
    1
    674700
    10/1/2023
    13
    7
    Order
    1
    674700
    10/1/2023
    Sheet: Sheet1
    So did I understand it correctly and you want a formula that count what I've said?

  15. #15
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    YES! Returns will only be 2 if the formula is correct, orders will be 6
    Last edited by AliGW; 03-04-2024 at 10:58 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  16. #16
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Did you try my suggestion in post #13?

  17. #17
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Quote Originally Posted by AliGW View Post
    Did you try my suggestion in post #13?
    Yes it works and get me the answer 2, but for some reason when I add two more return lines it gives me the answer 0 now, do you know why by any chance?

    Also, I dont get the formula at all so i cant see why it doesnt work, im not on the genius level u are but when I add rows 14 and 15 as returns for serial number 5 & 6 the answer is 0 instead of 4

    Attachment 861709

  18. #18
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Provide a workbook showing the issue, please - NOT a screenshot.

  19. #19
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Quote Originally Posted by AliGW View Post
    Provide a workbook showing the issue, please - NOT a screenshot.
    see attachments, i created two workbooks so it shows the additional rows

  20. #20
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Thanks. I'm not following the logic, sorry. I'll bow out at this point.

  21. #21
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Please don't, if you see the Excel that ends with "but 2 new rows added" it has 2 new rows of data added, your formula should provide the answer "4" since the two new rows are returns but shows "0"

    In the original excel the return answer of 2 is correct and perfect, but when I add new data to the list, the formula no longer provides the right answer.

    So the two excels attached are identical except "but 2 new rows added" has 15 rows of data and the original excel has only 13 rows of data where the formula you provided works.
    Last edited by AliGW; 03-04-2024 at 12:59 PM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  22. #22
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    I can't help - sorry. As I said, I don't understand the logic. It's not enough just knowing what the answer should be.

    Others will have ideas - be patient.

  23. #23
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Quote Originally Posted by AliGW View Post
    I can't help - sorry. As I said, I don't understand the logic. It's not enough just knowing what the answer should be.

    Others will have ideas - be patient.
    Let me try to explain once more, and I will not bother you again, in the excel "but 2 new rows added"

    1. two new rows show serial number 5 and serial number 6 being returned (rows 14 and 15).
    2, Serial numbers 5 and 6 were both purchased on or after the contract start date of 10/1/2023 - and are now being returned in rows 14 and 15
    3. Therefore the return answer is now "4", the original Excel's answer is "2" but the new returns of serial numbers 5 and 6 on rows 14 and 15 increased the total number of returns by 2 - but the formula shows "0" instead of "4"

  24. #24
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,009

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    VBA

    Please Login or Register  to view this content.
    "Data" is sorted and results are on sheet "Output", RUN button for macro
    Attached Files Attached Files
    Last edited by JohnTopley; 03-04-2024 at 01:48 PM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  25. #25
    Registered User
    Join Date
    02-29-2024
    Location
    toronto
    MS-Off Ver
    365
    Posts
    17

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    thank you jon but cant be VBA , i left all the dates the same as the return day can be the same day its ordered or a day after, it rly depends.
    Last edited by AliGW; 03-11-2024 at 09:38 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  26. #26
    Registered User
    Join Date
    02-29-2024
    Location
    EGYPT - Cairo
    MS-Off Ver
    MS365
    Posts
    91

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Sorry for the late reply.
    Please check the attached document.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Please load your full data to the file adjust the formula as needed and test many scenarios.
    If there is any extra requirement, just tell me.

  27. #27
    Registered User
    Join Date
    02-29-2024
    Location
    EGYPT - Cairo
    MS-Off Ver
    MS365
    Posts
    91

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    This is another much easier one using the LET function as it is much faster.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  28. #28
    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. 2501 (Windows 11 24H2 64-bit)
    Posts
    89,014

    Re: SUMIF function with multiple criteria from a data list to get orders and returns!

    Continuesd here:

    https://www.excelforum.com/excel-for...ml#post5929443

    There must be NO FURTHER ITERATIONS of this query.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Multiple Criteria If Function returns False but I wanto it to return Blank
    By Laro41 in forum Outlook Formatting & Functions
    Replies: 3
    Last Post: 11-21-2023, 12:00 PM
  2. Function that returns a value in a row that does not meet multiple criteria
    By FuriousStyles in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-20-2018, 11:10 AM
  3. Replies: 2
    Last Post: 06-21-2017, 06:32 PM
  4. Using a Comma separated list as criteria for sumif function
    By yoshik in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-25-2013, 12:47 AM
  5. SUMIF function with multiple criteria
    By anna57 in forum Excel General
    Replies: 2
    Last Post: 12-02-2009, 08:45 AM
  6. [SOLVED] Multiple Criteria for SumIf function
    By [email protected] in forum Excel General
    Replies: 6
    Last Post: 05-10-2006, 11:10 AM
  7. [SOLVED] SumIf Function using multiple criteria
    By Jamie A Miller in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2005, 02:06 PM

Tags for this Thread

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