+ Reply to Thread
Results 1 to 7 of 7

Need to Extract Data from middle of cell

Hybrid View

  1. #1
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129
    002 000950715 082687862003 UPC WS20 48 EA 3.9900 8/3 191.52
    003 000969736 082687112108 UPC SM6 12 EA 6.8800 4/3 82.56
    I think Excel Function is OK:
    B1=  LEFT(RIGHT(TRIM(A1),LEN(A1)-31),FIND(" ",RIGHT(TRIM(A1),LEN(A1)-31),1)-1)
    C1 = MID(RIGHT(TRIM(A1),LEN(A1)-31-LEN(B1)-1),1,FIND(" ",RIGHT(TRIM(A1),LEN(A1)-31-LEN(B1)-1),1)-1)*1
    Note:
    Trim(A1) to prevent A1 from extra space between character group.
    31 = len("002 000950715 082687862003 UPC ") = const for every strings
    Find(" ",....) - 1 : is the position of the first character in the string after cut 31 left characters
    and so on
    You may define a range name Str1 = RIGHT(TRIM($A1),LEN($A1)-31) when the cell point is in row 1.
    And another range name Str2 = RIGHT(TRIM($A1),LEN($A1)-31-LEN($B1)-1) when the cell point is also in row 1.
    Then the formulas are:
    B1 = left(Str1,find(" ",Str1,1)-1)
    C1 = Mid(Str2,1,Find(" ",Str2,1)-1)*1

  2. #2
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    It seems that you always want word 4 and 5 of the text.
    If that is the case, you can use the following code to extract word 4:
    =MID(MID(MID(SUBSTITUTE(A1," ","^",3),1,256),FIND("^",SUBSTITUTE(A1," ","^",3)),256),2,FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",3),1,256),FIND("^",SUBSTITUTE(A1," ","^",3)),256))-2)
    And for word 5:
    =MID(MID(MID(SUBSTITUTE(A1," ","^",4),1,256),FIND("^",SUBSTITUTE(A1," ","^",4)),256),2,FIND(" ",MID(MID(SUBSTITUTE(A1," ","^",4),1,256),FIND("^",SUBSTITUTE(A1," ","^",4)),256))-2)
    If you concatenate both, you should have what you want in a single (massive) formula.
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  3. #3
    Forum Contributor ptm0412's Avatar
    Join Date
    04-16-2008
    Location
    Vietnam
    MS-Off Ver
    Office 2003 and 2007
    Posts
    129
    Here is the attachment that I calculate in both ways: function with and without range name
    Attached Files Attached Files

+ 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