+ Reply to Thread
Results 1 to 6 of 6

Extrapolating multiple occurences of data from cell using ( ) as an identifier.

Hybrid View

  1. #1
    Registered User
    Join Date
    12-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Extrapolating multiple occurences of data from cell using ( ) as an identifier.

    Hello All-

    I'm trying to figure out a way to pull the numbers out of a cell and total them up using ( ) to identify when the numbers occur. The cell contains something like this:

    asdf(2.0); ASDF (3.0); ASDF (7.5);

    Any ideas? I'm stuck...

  2. #2
    Registered User
    Join Date
    10-17-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Extrapolating multiple occurences of data from cell using ( ) as an identifier.

    Are the values that you posted all in the same cell or in multiple cells? If they are in different cells then the below formula should work. You'll have to change the four instances of "A1" to the correct cell reference.

    =MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)

  3. #3
    Registered User
    Join Date
    12-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Extrapolating multiple occurences of data from cell using ( ) as an identifier.

    Thank you for the reply snax.

    The values are all in the same cell. The problem I'm having is that I only want the numbers within the ( ) and I need to keep the format of the numbers to be in tenths.

  4. #4
    Registered User
    Join Date
    10-17-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Extrapolating multiple occurences of data from cell using ( ) as an identifier.

    If you can do a text to columns with a semicolon as the delimiter and then use the formula above for each cell. If you can't do that then I believe the only other way to accomplish what you want done is through VBA.

  5. #5
    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: Extrapolating multiple occurences of data from cell using ( ) as an identifier.

    Probably the most versitile way to do this is with a UDF.

    This will sum any amount of numbers in brackets.
    Function SumCell(rng As Range)
        Dim strTemp As String
        Dim n As Long
        Dim switch As Boolean
        
        For n = 1 To Len(rng)
            If Not switch Then
                If Mid(rng, n, 1) = "(" Then
                    strTemp = strTemp & Mid(rng, n, 1)
                    switch = True
                Else
                    strTemp = strTemp & " "
                End If
            Else
                If Mid(rng, n, 1) = ")" Then
                    strTemp = strTemp & Mid(rng, n, 1)
                    switch = False
                Else
                    strTemp = strTemp & Mid(rng, n, 1)
                End If
            End If
        Next
        
        strTemp = WorksheetFunction.Trim(strTemp)
        
        SumCell = Evaluate(Replace(strTemp, " ", "+"))
    End Function
    Use in Excel
    Formula: copy to clipboard
    =sumcell(A2)


    See this workbook

    [EDIT]
    Workbook updated to prove your PM examples, seems fine to me ...

    Added another UDF just for fun ...
    Attached Files Attached Files
    Last edited by Marcol; 12-11-2012 at 02:33 PM.
    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.

  6. #6
    Registered User
    Join Date
    12-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Extrapolating multiple occurences of data from cell using ( ) as an identifier.

    This worked great, thanks Marcol!

+ 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