+ Reply to Thread
Results 1 to 9 of 9

Split text and combine it randomly (as function)

  1. #1
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Austria
    MS-Off Ver
    Excel 2016
    Posts
    169

    Split text and combine it randomly (as function)

    Hi everyone,
    I need your help again. I need a function that splits text in a cell and combine it again randomly. The first word should be the same again. But the function should not use every word from the original string. Just about 70%. Is this possible? Can you help me please?

    Example:
    A1: The car is black and fast
    A2: =wordsplit(A1) ... the result in A2: The black fast and

    THANK YOU!!!
    Kind Regards Roman

  2. #2
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Austria
    MS-Off Ver
    Excel 2016
    Posts
    169

    Re: Split text and combine it randomly (as function)

    I found this function:
    Please Login or Register  to view this content.
    Works fine to split the text. But when I copy the function from A1:A4 (4 Words), and my string is only 3 words long, than I got the error #NV in cell A4.
    How can I hide this error?
    Thanks again

  3. #3
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: Split text and combine it randomly (as function)

    Dear Moosmahna, plz try with below formula
    =SUBSTITUTE(A1,"car is","")


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  4. #4
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Austria
    MS-Off Ver
    Excel 2016
    Posts
    169

    Re: Split text and combine it randomly (as function)

    Got an error...

  5. #5
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Austria
    MS-Off Ver
    Excel 2016
    Posts
    169

    Re: Split text and combine it randomly (as function)

    Ok, I got it. But that is not useful. The split should work automatically. It is faster for me. Did you try the function?

  6. #6
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: Split text and combine it randomly (as function)

    Quote Originally Posted by moosmahna View Post
    Ok, I got it. But that is not useful. The split should work automatically. It is faster for me. Did you try the function?
    its work with excel2007

  7. #7
    Forum Contributor
    Join Date
    06-05-2013
    Location
    Austria
    MS-Off Ver
    Excel 2016
    Posts
    169

    Re: Split text and combine it randomly (as function)

    I use 2016...

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,396

    Re: Split text and combine it randomly (as function)

    How can I hide this error?
    Conditional formatting, using a formula similar to ISERROR(B1), then format as white font on white background or something like that.

    Is there a specific part of the algorithm that you have difficulty with? Here's how I see this happening.

    1) Using your UDF, split the text into an array, like you are currently doing.
    2) count how many actual words and how many error values. Likely some form of COUNTIF() or similar
    3) Generate a list of random unique integers between 2 and # of words. This post at MrExcel has a few simple examples. I know there are other approaches around the internet: http://www.mrexcel.com/forum/excel-q...m-numbers.html
    4) Arrange array from 1 into new order as determined in 3. INDEX() function with array from 1 and the list of random numbers generated in 3.
    5) Combine array from 4 into a single text string. TEXTJOIN() function.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Split text and combine it randomly (as function)

    Not really sure about "70%" though
    Please Login or Register  to view this content.

+ 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. Replies: 4
    Last Post: 11-11-2015, 03:00 PM
  2. combine TEXT function with INDEX function
    By kmbondra in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-13-2015, 12:39 PM
  3. Replies: 4
    Last Post: 07-25-2013, 05:28 AM
  4. Datalabel.Text randomly returns empty strings in a recursive function
    By Miragel in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-17-2012, 06:17 PM
  5. Replies: 3
    Last Post: 10-27-2010, 03:11 AM
  6. Combine Text & A Logic Function
    By jmaitri in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-15-2008, 06:41 PM
  7. [SOLVED] combine set of letters randomly
    By rp in forum Excel General
    Replies: 3
    Last Post: 09-16-2005, 01:05 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