+ Reply to Thread
Results 1 to 3 of 3

Help with Mid-Function and variable lengths.

Hybrid View

  1. #1
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Help with Mid-Function and variable lengths.

    This is a start

    =MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1)))

    It returns the position of the first occurrence of one of your search strings

    This finds the position of the first space after that point

    =FIND(" ",A1,MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1))))


    Put those togeather

    =MID(A1,MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1))),FIND(" ",A1,MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1))))-MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1))))

    Returns your text proceeded by your search string

    So you now need to get rid of your search string

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(MID(A1,MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1))),FIND(" ",A1,MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1))))-MIN(IF(ISERROR(FIND("Name",A1)),999,FIND("Name",A1)),IF(ISERROR(FIND("Surname",A1)),999,FIND("Surname",A1)),IF(ISERROR(FIND("Email",A1)),999,FIND("Email",A1)))),"Name",""),"Surname",""),"Email","")

    Messy ha?

    I would use a userdefined function instead.
    Last edited by mehmetcik; 05-31-2018 at 04:06 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Extract String After and Before Certain Characters of Variable Lengths
    By ex245 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-05-2017, 09:59 PM
  2. Adaptive forecasting based on variable project lengths
    By sjez27 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 07-27-2017, 10:00 AM
  3. Determining shipping fees with variable lengths/weights
    By bakedziti in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-14-2017, 12:54 PM
  4. Variable VBA Array Lengths, insert into cell as string
    By Speshul in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2014, 04:26 PM
  5. [SOLVED] Extract numbers of variable lengths from cell
    By Nizz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-18-2013, 10:11 AM
  6. [SOLVED] Extracting Text From Cells of Variable Lengths
    By stinkstik in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-25-2013, 02:46 PM
  7. [SOLVED] Parsing data of variable lengths
    By JP Romano in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-02-2011, 04:54 PM

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