+ Reply to Thread
Results 1 to 7 of 7

Formula cannot go above 255 chars. Help naming variable?

  1. #1
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Formula cannot go above 255 chars. Help naming variable?

    Ok so my formula simply wants to substitute a really long string of text with a blank cell. Problem is that the really long string of text goes over the 255 char limit for a formula.

    How can I go about solving this problem. I think you could name the string of text as a variable such as "long text" and then use the substitute formula as such:

    =SUBSTITUTE(A1,"long text", "")

    Something like that? I don't know if it would work or the steps to name the variable.

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula cannot go above 255 chars. Help naming variable?

    Perhaps put the "long text" in another cell, say B1

    =SUBSTITUTE(A1,B1,"")

  3. #3
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Formula cannot go above 255 chars. Help naming variable?

    Quote Originally Posted by Jonmo1 View Post
    Perhaps put the "long text" in another cell, say B1

    =SUBSTITUTE(A1,B1,"")
    Ok so what I'm doing is pulling web data and then using formulas to edit the text returned. The web data will vary with each refresh so the "long text" will not always be in the same cell.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula cannot go above 255 chars. Help naming variable?

    I don't understand...

    I thought the only problem with this formula
    =SUBSTITUTE(A1,"long text", "")
    Was because the "long text" couldn't be longer than 255 characters (or the whole formula itself)

    How would you have used that formula if there wasn't a limit of 255 characters?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,595

    Re: Formula cannot go above 255 chars. Help naming variable?

    You could define a Named Range, for example, nrLotsOfXXXs containing, say, ="xxxxx...xxxxx".

    You could then use, for example,
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note that the Named Range is still limited to 255 characters but you can concatenate the Named Ranges together.

    So, you could take your long text and split it into two or more Named Ranges and then concatenate them together. Or you might get away with just putting the values in two or more cells and concatenating the values.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Contributor
    Join Date
    12-29-2012
    Location
    usa
    MS-Off Ver
    Excel 2016
    Posts
    325

    Re: Formula cannot go above 255 chars. Help naming variable?

    Quote Originally Posted by TMShucks View Post
    You could define a Named Range, for example, nrLotsOfXXXs containing, say, ="xxxxx...xxxxx".

    You could then use, for example,
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note that the Named Range is still limited to 255 characters but you can concatenate the Named Ranges together.

    So, you could take your long text and split it into two or more Named Ranges and then concatenate them together. Or you might get away with just putting the values in two or more cells and concatenating the values.

    Regards, TMS
    Got it to work. Thanks a lot for the explanation!

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,595

    Re: Formula cannot go above 255 chars. Help naming variable?

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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: 10-09-2013, 06:26 PM
  2. [SOLVED] Declaring and naming a variable
    By ExcelAteMyHomework in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-30-2012, 03:07 PM
  3. [SOLVED] Naming a variable that changes monthly
    By ATLGator in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2012, 04:25 PM
  4. How to get set of chars from a string to a variable. Part II
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-08-2010, 04:19 PM
  5. How to get set of chars from a string to a variable
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-24-2009, 10:40 AM

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