Results 1 to 2 of 2

Thread: Extracting number in a string between braces {0.8059}

  1. #1

    Extracting number in a string between braces {0.8059}



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Please help extract the below numbers string located in cell A1 and place each in its separate cell in another sheet.

    I want to use SQL or VBA codes to extract 0.0593, 0.3240, 0.6967... 0.5347 from cell A1 and place them in their separate cells in another sheet.

    Currently, Sheet 1 cell A1 contains:
    {0.0593} {0.3240} {0.6967} {0.8059} {0.5232} {0.016} {0.2571} {0.028} {0.2672} {0.2357} {0.9829} {0.9147} {0.2501} {0.9076} {0.5915} {0.7498} {0.9464} {0.1989} {0.341} {0.7891} {0.2747} {0.3774} {0.8449} {0.0873} {0.9707} {0.0891} {0.8574} {0.0894} {0.1223} {0.5094} {0.9693} {0.0707} {0.9802} {0.5838} {0.0343} {0.3994} {0.5984} {0.4721} {0.039} {0.6538} {0.5928} {0.1375} {0.5706} {0.9789} {0.7281} {0.6833} {0.9465} {0.2731} {0.3951} {0.8262} {0.4888} {0.415} {0.9401} {0.4709} {0.1038} {0.5347}

    Seeking result (Sheet 2):
    A1: 0.0593 B1: 0.3240 C1: 0.6967 etc.
    A2: 0.5915 B2: 0.7498 C2: 0.9464 etc.
    A3: 0.1223 B3: 0.5094 C3: 0.9693 etc.
    etc.

    Any alternative method/s to extract them from one cell will greatly be appreciated.

    Thank you.
    Ziki

  2. #2
    Seeker Gary's Student's Avatar
    Join Date
    Mar 2014
    Location
    Lakehurst, NJ, USA
    Posts
    5
    Articles
    0
    This small macro will take the contents of cell A1 and place the values in a single column in Sheet2:

    Code:
    Sub ReOrganizeData()
        Dim v As String, a As Variant, j As Long
        v = Range("A1").Text
        v = Replace(v, " ", "")
        v = Replace(v, "}", "")
        ary = Split(v, "{")
        j = 1
        For Each a In ary
            If a <> "" Then
                Sheets("Sheet2").Cells(j, 1).Value = a
                j = j + 1
            End If
        Next a
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •