+ Reply to Thread
Results 1 to 9 of 9

Sum values held in a text string

  1. #1
    Registered User
    Join Date
    04-21-2009
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Sum values held in a text string

    Hi all,

    I've got quite a bit of data here that shows general information (held in a single text string) for someone over a calendar year, so each cell will represent the information for a particular person on one particular day. Each cell contains the following information: FTE (in 0.00 format), whether or not this 'person' is actually physically here 'R' or is a current vacancy 'V', their contract type (REG for regular, FIX for Fixed term or TEM, for an agency temp) and finally a three letter code for the team they currently sit on. A normal cell would look like this: 1.00RREGCHO.

    What I'm trying (and currently failing) to do is to find a way to sum all of the data for a single day (there are currently 147 rows of data, but this will expand.) So I need to separate the first 4 characters of the reference, turn it into a value and then sum the resultant numbers. I also need to use SUMIF to break this down further, to get totals for a particular team or contract type etc.

    I've had a look around but couldn't find anything related to this, apologies in advance if I've missed it.

    Many thanks in advance as always

    Jon
    Last edited by Jonsocks; 01-16-2012 at 05:18 AM. Reason: Solved!

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sum values held in a text string

    =SUM(IF(ISERROR(--LEFT(A1:A10,4)),0,--LEFT(A1:A10,4))) array entered should give sum
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    09-26-2010
    Location
    A, A
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: Sum values held in a text string

    You can use left function and get the values for each cell, assuming 1.00RREGCHO is in cell A1 then formula will be...
    =left(A1,4)*1 this will convert the text to a number and then u can use SUMIF and get the sum for a particular date
    =sumif(range, "Criteria", Sum Range).. assuming the dates are in column B and the values are in Column C then function will be,

    =sumif(B:B,"Enter Date",C:C)

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sum values held in a text string

    Unfortunately SUMIFS() is not as versatle as it could or should be.
    Try this
    Please Login or Register  to view this content.
    where *1 is the numeric value of your first 4 characters. i.e. "1.00"

    [EDIT]
    There is a difference in interpretating your query
    Martin is summing the whole column, I'm returning the sum for a specific value
    Last edited by Marcol; 01-13-2012 at 08:00 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sum values held in a text string

    Hi Jon

    For separate the values, of a referance in A1, use this formula(Not usefuull for excel<2007)

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1;0;"");9;"");8;"");7;"");6;"");5;"");4;"");3;"");2;"");1;"");" ";" ")

    I use Excel2003, so i can not test it now.

    Hope to helps you.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  6. #6
    Registered User
    Join Date
    04-21-2009
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Sum values held in a text string

    Thanks for such speedy responses! I'm currently working my way through them, thanks to martindwilson as that sum formula is working a treat, Marcol, if I wanted to sum the FTE in a range of cells as you've outlined above, but base it on slightly different criteria, (so to view the contract type I'd use "=RIGHT(LEFT(E2,8),3)" and then insert that into a formula that would return the sum of the FTE values) would that work?

    Jon

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Sum values held in a text string

    Quote Originally Posted by Marcol View Post
    Please Login or Register  to view this content.
    where *1 is the numeric value of your first 4 characters. i.e. "1.00"
    I might be wrong but operating on "numeric" text automatically coerces the strings to numbers, so the multiplication by 1 is not necessary

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sum values held in a text string

    @ pepe
    In this case you are correct, but consider the result if the first 4 characters are "2.00", or say "1.02". Then the multiplier is required.

  9. #9
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Sum values held in a text string

    Try this to get SUMIF for REG,

    =SUMPRODUCT(--ISNUMBER(SEARCH("REG",A1:A148)),--LEFT(0&A1:A148,5))

    For whole sum,

    =SUMPRODUCT(--LEFT(0&A1:A148,5))

    Note: There is 0& before the range.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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