+ Reply to Thread
Results 1 to 18 of 18

Sum ifs to combine same data into one cell

  1. #1
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Sum ifs to combine same data into one cell

    Hello,

    I'm working on an expense/mileage report and I need to be able to combine any duplicates from my columns S & T and add them to my columns W & X. These will total with the sum if formula already in column Y. As you can see from my example codes and amounts (in red). 710 and 6730.00 both should be combined together in W & X to add both amounts together as shown in column Y. Is there a formula (like another sumif) that I can use to do this automatically for me? See attached file.

    As always thank you for any help you can provide.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sum ifs to combine same data into one cell

    How are you deriving the unique Project code in column W? Is this done manually? The same with the Cost code?

    You can use this formula in W21:

    =SUMIFS($U$21:$U$34,$S$21:$S$34,W21,$T$21:$T$34,X21)

    then copy down as required.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    Yes I normally do this manually. But the formula didn't work. It returned 0. Wouldn't using W21 make the formula not work since it's in the same column as the formula itself? I just noticed that the formula you gave me is the same one as the one already in column Y.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sum ifs to combine same data into one cell

    Yes, it should go into Y21. I don't know why it should return 0 for you - I got the numbers expected.

    Pete

  5. #5
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    I have the formula in column Y already.

    What I need is in columns W & X. I need the number that are in red in W & X to populate for me automatically. As you can see from my sheet, in Column S & T there are two 710's and 6730's. I need both of those to be combined in column W & X.

    in W21, it would be 7102122.51
    in X21, it would be 01.3840.00
    because they're only in columns S & T once.

    in W22, it would be 710
    in X22, it would be 6730
    but since these are listed two times in columns S & T, they would be listed once added once but the totals would be added as they are now $63.05.

    in W23, it would be 712
    in X21, it would be 7190
    because they're only in columns S & T once.

    So basically I want my duplicates from S&T should be combined into one in W & X

    Please let me know if I'm confusing..
    Last edited by trosasco23; 01-27-2023 at 02:36 PM.

  6. #6
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    Is what I needed in this report not possible?

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sum ifs to combine same data into one cell

    You can use this array* formula in cell W21:

    =IFERROR(INDEX($J$21:$J$34,MATCH(0,COUNTIF(W$20:W20,$J$21:$J$34),0)),"")

    and this array* formula in X21:

    =IFERROR(INDEX($L$21:$L$34,MATCH(0,COUNTIF(X$20:X20,$L$21:$L$34),0)),"")

    *Note that an array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter instead of the usual Enter.

    Then you can copy them down to row 34 to get those unique values that you seem to be asking for.

    Hope this helps.

    Pete

  8. #8
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    Yessss!!!! This is what I needed. You are the best. thank you so much Pete

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: Sum ifs to combine same data into one cell

    Well, glad we finally got there, and thanks for marking the thread as Solved.

    You might also like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

  10. #10
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    Hello, I had to re-open this thread because I just realized that the formulas given work to some extent but don't work as they should for every scenario. I highlighted the discrepancies where the numbers should match and they don't. I am aware that I need to use the CTRL+SHIFT+ENTER. Please see attached.

  11. #11
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    Hello, can someone please help me to figure this out? Please see attached from the above file.

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

    Re: Sum ifs to combine same data into one cell

    T21=IFERROR(INDEX(J$21:J$34,SMALL(IF(FREQUENCY(IF(J$21:J$34<>"",MATCH($J$21:$J$34&$K$21:$K$34,$J$21:$J$34&$K$21:$K$34,0)),ROW(J$21:J$34)-ROW(J$21)+1),ROW(J$21:J$34)-ROW(J$21)+1),ROWS($T$20:T20))),"")

    Control+shift+enter

    copy across and down

    V21=SUMPRODUCT(($J$21:$J$34=$T21)*($K$21:$K$34=$U21)*($C$21:$I$34))

    Copy down

  13. #13
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    OH WOW... you are amazing. I see that you deleted the first box. I guess it wasn't needed anymore. Thank you so much. Can I ask how do you read these formulas in plain English? They are so long and I'd really like to learn how you came up with that.

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

    Re: Sum ifs to combine same data into one cell

    I moved the "cost code" column next to the "Project#" column to use a unique formula for
    get the unique values for these two columns.
    The intermediate table for the sum is no longer needed using the sumproduct function

    for learn https://www.youtube.com/user/excelisfun
    Last edited by CARACALLA; 02-23-2023 at 04:01 PM.

  15. #15
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Re: Sum ifs to combine same data into one cell

    oh ok. Now, I just realized that if someone submits both an expense report and a mileage report at the same time, the totals in column V would need to be included from the mileage rate column (Q)...how would I tweak that in the column V formula?

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

    Re: Sum ifs to combine same data into one cell

    v21=SUMPRODUCT(($J$21:$J$34=$T23)*($L$21:$L$34=$U23)*($C$21:$I$34))+SUMPRODUCT(($J$21:$J$34=$T23)*($L$21:$L$34=$U23)*($Q$21:$Q$34))

    copy down

  17. #17
    Forum Contributor
    Join Date
    06-27-2014
    Location
    Margate, FL
    MS-Off Ver
    MS Office 2016
    Posts
    220

    Unhappy Re: Sum ifs to combine same data into one cell

    That didn't work. The previous formulas worked perfectly. I just needed to include column Q to it. I'm sorry.

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

    Re: Sum ifs to combine same data into one cell

    sorry

    V21=SUMPRODUCT(($J$21:$J$34=$T21)*($L$21:$L$34=$U21)*($C$21:$I$34))+SUMPRODUCT(($J$21:$J$34=$T21)*($L$21:$L$34=$U21)*($Q$21:$Q$34))

    Copy down
    Last edited by CARACALLA; 02-23-2023 at 05:15 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. [SOLVED] Combine Cell Data
    By Chasermelb in forum Excel General
    Replies: 3
    Last Post: 10-14-2019, 12:27 AM
  2. [SOLVED] Combine data in one cell
    By Marion59 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-11-2019, 01:09 AM
  3. How to combine similar column cell and paste the corresponding data to another cell?
    By RakeshSiripurapu in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-28-2016, 01:59 PM
  4. Replies: 8
    Last Post: 11-25-2013, 10:26 PM
  5. Replies: 8
    Last Post: 07-05-2012, 11:27 AM
  6. Combine data from one cell to another based on duplicate data in another cell
    By bzenker in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-15-2011, 01:09 AM
  7. Replies: 1
    Last Post: 01-29-2010, 12:52 AM

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