+ Reply to Thread
Results 1 to 23 of 23

Need help solving this sumif scenario

  1. #1
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Need help solving this sumif scenario

    Hello All,

    I'm having a difficult time trying to write a formula that solve this scenario. I want to sum up certain task columns (TK1, TK2, TK3, etc) that has a weighted value. I also like to incorporate an if type statement from Type column as a criteria (like if Type = "NB") then add the task columns value. Each task column has a status (OUT, PEND, COMP). Depending on the task the value assigned will be different. Please see attached file for sampling and result wanted. I'm not sure how best to approach this scenario.



    Thank you in advance.
    Attached Files Attached Files
    Last edited by AliGW; 03-03-2022 at 02:36 AM. Reason: Thread tagged as solved - no need to edit the thread title!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Need help solving this sumif scenario

    I think I understand the results for rows 2-4:

    OUT+COMP+PEND+COMP = 0+1+.5+1 = 2.5
    PEND+PEND+COMP+OUT = .5+.5+1+0 = 2
    COMP+PEND+COMP+PEND = 1+.5+1+.5 = 3

    But why are rows 5-7 the "ELSE=TYPENAME" result? Why aren't they:

    OUT+OUT+OUT+OUT = 0+0+0+0 = 0
    PEND+COMP+COMP+OUT = .5+1+1+0 = 2
    COMP+OUT+COMP+PEND = 1+0+1+.5 = 2.5

    ?

  3. #3
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    Good question. There is another column that im using that does all of that, but there are some type that does not follow the same assigned value so for those few types i want to create a formula specifically for them and everything else remains the same. Hope i make sense.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Need help solving this sumif scenario

    Without knowing the other conditions, something like this fits your results:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Essentially, if A2 is NB, DP or RG, then count the number of COMP's and add the number of PEND's divided by 2. Since OUT's are 0, no need to count or sum them in the example given.

  5. #5
    Forum Contributor John Vergara's Avatar
    Join Date
    01-17-2022
    Location
    Colombia
    MS-Off Ver
    365
    Posts
    206

    Re: Need help solving this sumif scenario

    Hi to all!

    You can use this formula:
    [F2] : =IF(OR(A2={"AP";"ZZ";"CP"}),A2,SUMPRODUCT((B2:E2={"PEND";"COMP"})*{0.5;1}))
    Blessings!

  6. #6
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32
    @John

    Im getting a spill error with this formula?
    Last edited by AliGW; 02-26-2022 at 12:41 PM. Reason: PLEASE don't quote unnecessarily!

  7. #7
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    @Paul

    Hi Paul,

    Thank you for the formula. It does work; however, I apologize for leaving out some crucial information that might render this formula ineffective. Each task column has a status (OUT, PEND, COMP). Depending on the task the value assigned will be different, but will always add up to 100 if all tasks were to be completed. Please see attached revised Excel sheet for a clearer defined parameter.
    Attached Files Attached Files
    Last edited by AliGW; 02-26-2022 at 01:08 PM. Reason: PLEASE don't quote unnecessarily!

  8. #8
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,991

    Re: Need help solving this sumif scenario

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    Type TK1 TK2 TK3 TK4 RESULT WANTED TK1OUT
    0
    2
    NB OUT COMP PEND COMP
    60
    TK2OUT
    0
    3
    DP PEND PEND COMP OUT
    65
    TK3EOUT
    0
    4
    RG COMP COMP COMP COMP
    100
    TK4OUT
    0
    5
    AP OUT OUT OUT OUT AP TK1PEND
    10
    6
    ZZ PEND COMP COMP OUT ZZ TK2PEND
    15
    7
    CP COMP OUT COMP PEND CP TK3PEND
    20
    8
    TK4PEND
    5
    9
    TK1COMP
    20
    10
    TK2COMP
    30
    11
    TK3COMP
    40
    12
    TK4COMP
    10




    F2=IF(ROWS($B$2:B2)<=3,SUMPRODUCT(SUMIF($I$1:$I$12,Table2[[#Headers],[TK1]:[TK4]]&Table2[@[TK1]:[TK4]],$J$1:$J$12)),[@Type])


    Copy down
    Last edited by CARACALLA; 02-26-2022 at 02:34 PM.

  9. #9
    Forum Contributor John Vergara's Avatar
    Join Date
    01-17-2022
    Location
    Colombia
    MS-Off Ver
    365
    Posts
    206

    Re: Need help solving this sumif scenario

    Hi again!

    With your new "adding", Check this formula:
    =IF(OR(A2={"AP";"ZZ";"CP"}),A2,SUMPRODUCT(B$18:E$18*({"PEND";"COMP"}=B2:E2)/{2;1}))

    Blessings!
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    CARACALLA

    For some reason, I have 50 instead of 60 for F2 cell, the rest are good, though.

    I'm having trouble understanding the formula. I would really appreciate if you could explain it to me so i can learn the concept. Thank you much!

  11. #11
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    Quote Originally Posted by John Vergara View Post
    Hi again!

    With your new "adding", Check this formula:
    =IF(OR(A2={"AP";"ZZ";"CP"}),A2,SUMPRODUCT(B$18:E$18*({"PEND";"COMP"}=B2:E2)/{2;1}))

    Blessings!
    This work perfectly

  12. #12
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,991

    Re: Need help solving this sumif scenario

    In my file is 60
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    Quote Originally Posted by CARACALLA View Post
    In my file is 60
    Thank you. Can you explain what this portion of the formula means

    ROWS($B$2:B2)<=3

  14. #14
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    Quote Originally Posted by John Vergara View Post
    Hi again!

    With your new "adding", Check this formula:
    =IF(OR(A2={"AP";"ZZ";"CP"}),A2,SUMPRODUCT(B$18:E$18*({"PEND";"COMP"}=B2:E2)/{2;1}))

    Blessings!
    Hello Mr. John Vergara,

    Can i present you with another scenario? This one is a bit more complex (at least for me). Would love your input and expertise on solving it. Thank you, again.
    Attached Files Attached Files

  15. #15
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2503 and WPS V2024(12.1.0.18543)
    Posts
    3,872

    Re: Need help solving this sumif scenario

    ANS.POST#14

    First please change the "FULL VALUE" of J19 cell to 1
    Cell Y30 formula , drag down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  16. #16
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Need help solving this sumif scenario

    Please try..

    By create listting table at G13:I28
    TK1, Out, 0 ... and so on.

    then (2 formula)

    1. =IF(OR(A2="NB",A2="DP",A2="RG"),SUM(SUMIFS($I$13:$I$28,$H$13:$H$28,TRANSPOSE(Table23[@[TK1]:[TK4]]),$G$13:$G$28,TRANSPOSE(Table23[[#Headers],[TK1]:[TK4]]))),A2)
    follow with Ctrl-shift-enter for array formula.

    2. =IF(OR(A2="NB",A2="DP",A2="RG"),
    SUMIFS($I$13:$I$28,$G$13:$G$28,Table23[[#Headers],[TK1]],$H$13:$H$28,Table23[@TK1])
    +SUMIFS($I$13:$I$28,$G$13:$G$28,Table23[[#Headers],[TK2]],$H$13:$H$28,Table23[@TK2])
    +SUMIFS($I$13:$I$28,$G$13:$G$28,Table23[[#Headers],[TK3]],$H$13:$H$28,Table23[@TK3])
    +SUMIFS($I$13:$I$28,$G$13:$G$28,Table23[[#Headers],[TK4]],$H$13:$H$28,Table23[@TK4]),A2)


    Regards.
    Attached Files Attached Files

  17. #17
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Need help solving this sumif scenario

    For Post #14

    If you don't mind to restructure your worksheet.
    I change data table into one single table (format as range not table).

    Then I use
    =SUM(IFERROR(SUMIFS(OFFSET($D$2,1,MATCH($B33,$E$2:$H$2,0),ROWS($D$3:$D$23)),$D$3:$D$23,TRANSPOSE($D$32:$X$32)),1)*(SUMIF($J$3:$J$7,TRANSPOSE($D33:$X33),$K$3:$K$7)))
    Follow with Ctrl-shift-enter for array.

    Regards.

    Note: In case column B is not in the list, it's will use COMP as 1 and PEND as 0.5

    My question: Colud you please tell me , why the last DPIS result is 47 not 42.
    Attached Files Attached Files
    Last edited by menem; 03-01-2022 at 03:53 AM. Reason: Add question.

  18. #18
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    Quote Originally Posted by menem View Post
    For Post #14

    If you don't mind to restructure your worksheet.
    I change data table into one single table (format as range not table).

    Then I use
    =SUM(IFERROR(SUMIFS(OFFSET($D$2,1,MATCH($B33,$E$2:$H$2,0),ROWS($D$3:$D$23)),$D$3:$D$23,TRANSPOSE($D$32:$X$32)),1)*(SUMIF($J$3:$J$7,TRANSPOSE($D33:$X33),$K$3:$K$7)))
    Follow with Ctrl-shift-enter for array.

    Regards.

    Note: In case column B is not in the list, it's will use COMP as 1 and PEND as 0.5

    My question: Colud you please tell me , why the last DPIS result is 47 not 42.
    Thank you so much. The restructure worksheet you've provided is a much cleaner look, preferably too. The DPIS was suppose to be 42 that was error in my part.

    Can you explain what you mean by your statement "Note: In case column B is not in the list, it's will use COMP as 1 and PEND as 0.5"

    I'm in the process of working out the detail with your suggestions and will report back if I run into any issues.

    Thank you, again, for taking your time to help.

  19. #19
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2503 and WPS V2024(12.1.0.18543)
    Posts
    3,872

    Re: Need help solving this sumif scenario

    @punksterz626

    Does the POST#15 formula meet your needs?

  20. #20
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Need help solving this sumif scenario

    "Note: In case column B is not in the list, it's will use COMP as 1 and PEND as 0.5"

    meaning is ....

    if the data in column B (for sample B33:B41) not found in the list of E2:H2 it will remains as 1
    and multiply with the value lookuped from J3:K7
    =SUM(IFERROR(SUMIFS(OFFSET($D$2,1,MATCH($B33,$E$2:$H$2,0),ROWS($D$3:$D$23)),$D$3:$D$23,TRANSPOSE($D$32:$X$32)),1)*(SUMIF($J$3:$J$7,TRANSPOSE($D33:$X33),$K$3:$K$7)))

    Regards.

  21. #21
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    Quote Originally Posted by menem View Post
    For Post #14

    If you don't mind to restructure your worksheet.
    I change data table into one single table (format as range not table).

    Then I use
    =SUM(IFERROR(SUMIFS(OFFSET($D$2,1,MATCH($B33,$E$2:$H$2,0),ROWS($D$3:$D$23)),$D$3:$D$23,TRANSPOSE($D$32:$X$32)),1)*(SUMIF($J$3:$J$7,TRANSPOSE($D33:$X33),$K$3:$K$7)))
    Follow with Ctrl-shift-enter for array.

    Regards.

    Note: In case column B is not in the list, it's will use COMP as 1 and PEND as 0.5

    My question: Colud you please tell me , why the last DPIS result is 47 not 42.
    How do i change the result number as general to percentage? When I format the general number to percentage it went into the thousands.

    Example: Result show 10, but when I switch to Percentage it shows 1000.00%. I want it to show 10%. Anyway to correct the formatting?

    SOLVED: I changed the helper numbers to decimal point and it solved it.
    Last edited by punksterz626; 03-02-2022 at 06:46 PM.

  22. #22
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: Need help solving this sumif scenario

    Just wanted to say thank you to everyone who chimed in to assist me @Paul @John Vergara @CARACALLA @wk9128 and @menem

    All the formulas worked!!! I ended up using @menem post #17 suggestion due to the flexibility to expand in the future.

    Thank you again.

  23. #23
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    China Shanghai
    MS-Off Ver
    365 V2503 and WPS V2024(12.1.0.18543)
    Posts
    3,872

    Re: [SOLVED] Need help solving this sumif scenario

    @punksterz626 You're Welcome. Glad to help . Thank You for the feedback

+ 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. Muliply if A if met scenario 1, multiply B if met scenario 2
    By sanderacosta27 in forum Excel General
    Replies: 1
    Last Post: 11-30-2020, 05:18 AM
  2. Automatically Run Macro Once a Different Scenario is Chosen in Scenario Manager
    By because789 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-08-2020, 03:42 PM
  3. Making a Scenario Pivot Table in Scenario Manager Issue
    By davandbar in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-22-2018, 03:33 PM
  4. Impossible Sumif scenario
    By boon-yao.tek in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-29-2013, 02:56 AM
  5. Scenario Manager displays same result for every scenario
    By terihoff in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 11-10-2012, 07:14 PM
  6. Replies: 1
    Last Post: 07-26-2012, 09:21 AM
  7. Replies: 6
    Last Post: 12-09-2007, 11:09 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