+ Reply to Thread
Results 1 to 3 of 3

Extract a substring with formula

  1. #1
    Registered User
    Join Date
    09-10-2010
    Location
    Albany, NY
    MS-Off Ver
    Excel 2007
    Posts
    1

    Extract a substring with formula

    I am trying to extract a substring with this formula

    =Mid(D2,Find(“acct_num“,D2)+1,20)

    and it is not working as intended.

    The layout of the worksheet is
    Number |Date |Name |Description

    The description is variable in length so I cannot use left or right. Mid and Find seem to be the right formulas but I just cannot make them work together to find the substring.

    Any ideas?

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Extract a substring with formula

    Hi Bob, welcome to the forum.

    Perhaps provide some sample data and your expected results.

    Also note that the FIND function is case-sensitive, while SEARCH is not. FIND also doesn't allow wild-card usage, while SEARCH does.

    Finally note that if it does find "acct_num", the position returned will be that of the first character in "acct_num". So instead of adding 1 to the FIND, add 8 to get to the first character after "acct_num".

  3. #3
    Valued Forum Contributor
    Join Date
    05-13-2010
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2003; 2007
    Posts
    441

    Thumbs up Help from Brazil !

    Dear bobwachs, Good Evening.

    Your explanation is a little confuse but I´ll try to help you.

    Suppose you have this layout:


    ....A.............B...............C...............D.............................
    1..Number....Date...........Name........Description..................
    2..123..........12/25/2010..Person A...TOacct_num12345678901234567890XW


    Do B4 --> =Mid(D2,Find("acct_num",D2)+8,20)

    The result must be: 12345678901234567890

    Tell me, if Is this what you want.


    I hope it can help.
    ...If my answer helped you, Please, click on. * Add Reputation (at left)

    Best regards.
    Marc?lio Lob?o

+ 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