+ Reply to Thread
Results 1 to 12 of 12

How to Sum Numbers from part of a Cell

  1. #1
    Registered User
    Join Date
    05-15-2015
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    3

    Question How to Sum Numbers from part of a Cell

    Hi, I am trying to work out how to sum a number from a cell that contains multiple bits of information. My information is like this
    Game 1 Player A - 2, Player B - 1, Player C - 1
    Game 2 Player A - 2, Player C - 2
    Game 3 Player B - 2

    I want to be able to sum the number after - for each player so that a get a total for a particular player i.e. Player A - Sum = 4.

    Is this possible in excel? Appreciate any help anyone can give!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: How to Sum Numbers from part of a Cell

    Hi, welcome to the forum

    Where does this info come from? 1 of the biggest problems we see on the forum is members having "dirty" data to work with. If the data is is in a logical, structured format, summaries are simple. When values get mixed up with text, it makes things more complicated, and when multiple data (numeric and text) is included in 1 cell, it can become really difficult to extract.

    I will see what I can come up with
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to Sum Numbers from part of a Cell

    Deleted. I think I misread the requirements.
    Last edited by AlKey; 05-15-2015 at 05:21 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: How to Sum Numbers from part of a Cell

    This is what I came up with, using helper columns for each player. These can be hidden if needed...
    A
    B
    C
    D
    E
    F
    G
    1
    Player A Player B Player C Player D Player E
    2
    Game 1 Player A - 2, Player B - 1, Player C - 0
    2
    1
    0
    3
    Game 2 Player A - 4, Player C - 2
    4
    2
    4
    Game 3 Player B - 2
    2
    5
    Game 4 Player B - 5, Player C - 4, Player D - 3, Player E - 2
    5
    4
    3
    2

    C2=IF(COLUMNS($A$1:A$1)>LEN($B2)-LEN(SUBSTITUTE($B2,",",""))+1,"",IF(COLUMNS($A$1:A$1)<=LEN($B2)-LEN(SUBSTITUTE($B2,",","")),--MID($B2,FIND("xx",SUBSTITUTE($B2,",","xx",COLUMNS($A$1:A$1)),1)-1,1),--RIGHT($B2,1)))
    copied down and across.

    You would then just sum per player

    edit: Nope, sorry, that doesnt work, back to the crawing board

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to Sum Numbers from part of a Cell

    I like Ford's idea with the header so, here is my take on it

    in C2 and pull formula to the right and down

    =IFERROR(--MID(SUBSTITUTE($B2,","," "),SEARCH(C$1,SUBSTITUTE($B2,","," "))+11,2),0)

    Row\Col
    A
    B
    C
    D
    E
    F
    1
    Game Palyers Player A Player B Player C Player D
    2
    Game 1 Player A - 2, Player B - 1, Player C - 1
    2
    1
    1
    0
    3
    Game 2 Player A - 2, Player C - 2
    2
    0
    2
    0
    4
    Game 3 Player B - 2
    0
    2
    0
    0
    5
    Game 4 Player D - 10, Player C - 5
    0
    0
    5
    10
    6
    4
    3
    8
    10

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: How to Sum Numbers from part of a Cell

    Thanks for that AlKey, I was heading into some deep stuff here....
    =IF(COLUMNS($A$1:A$1)>LEN($B6)-LEN(SUBSTITUTE($B6,",",""))+1,"",IF(COLUMNS($A$1:A$1)<=LEN($B6)-LEN(SUBSTITUTE($B6,",","")),--MID($B6,FIND("xx",SUBSTITUTE($B6,",","xx",COLUMNS($A$1:A$1)),1)-1,1),--RIGHT($B6,1)))

    Wasnt quite working, but your's is far simpler anyway

  7. #7
    Registered User
    Join Date
    05-15-2015
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: How to Sum Numbers from part of a Cell

    Thanks guys for your help. I have been looking at AlKey way of doing at that works great but for one issue. The data actually contains the Players name i.e. J.Bloggs, J.Smith, A.Nother. The length of the names can vary from 5 characters up to say 10. Is there a way of working it with variable lengths of data?

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: How to Sum Numbers from part of a Cell

    OK, there back to my v ersion...
    C2=IFERROR(IF(COLUMNS($A$1:A$1)>LEN($B2)-LEN(SUBSTITUTE($B2,",",""))+1,"",IF(COLUMNS($A$1:A$1)<=LEN($B2)-LEN(SUBSTITUTE($B2,",","")),--MID(SUBSTITUTE(SUBSTITUTE($B2,C$1,"xx"),C$1,"xx"),FIND("xx",SUBSTITUTE(SUBSTITUTE($B2,C$1,"xx"),C$1,"xx"),1)+5,1),--RIGHT($B2,1))),"")
    copied down and across

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to Sum Numbers from part of a Cell

    This was rather easy to adjust my formula

    =IFERROR(--MID(SUBSTITUTE($B2,","," "),SEARCH(C$1,SUBSTITUTE($B2,","," "))+LEN(C$1)+3,2),0)


    Row\Col
    A
    B
    C
    D
    E
    F
    1
    Game Players J.Bloggs J.Smith A.Nother M.Barton
    2
    Game 1 J.Bloggs - 2, J.Smith - 1, A.Nother - 17
    2
    1
    17
    0
    3
    Game 2 J.Bloggs - 2, A.Nother - 22
    2
    0
    22
    0
    4
    Game 3 J.Smith - 2
    0
    2
    0
    0
    5
    Game 4 M.Barton - 10, A.Nother - 5
    0
    0
    5
    10
    6
    4
    3
    44
    10
    Last edited by AlKey; 05-15-2015 at 07:28 PM.

  10. #10
    Registered User
    Join Date
    05-15-2015
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: How to Sum Numbers from part of a Cell

    Spot on! Just what I was after. Thanks to you both.

  11. #11
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to Sum Numbers from part of a Cell

    Thank you for the feedback!

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: How to Sum Numbers from part of a Cell

    happy to help, thanks 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. [SOLVED] reference part of cell address from button and part of another cell
    By JJGF in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-24-2012, 04:48 PM
  2. Find Part number through Macro and output to associated part to certain cell
    By boylers75 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2012, 04:32 PM
  3. Grouping Part Numbers
    By ItsAlan in forum Excel General
    Replies: 1
    Last Post: 08-29-2011, 12:04 PM
  4. Vlookup on part of cell (numbers)
    By kt1978 in forum Excel General
    Replies: 2
    Last Post: 02-03-2011, 06:31 PM
  5. Replies: 5
    Last Post: 03-29-2010, 06:01 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