+ Reply to Thread
Results 1 to 7 of 7

FormulaArray does not work for more than 255 characters

  1. #1
    Registered User
    Join Date
    12-02-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    74

    FormulaArray does not work for more than 255 characters

    Hi Guys,

    I am trying to FormulaArray in my code and it does not work for formula having more than 255 characters. I have already tried couple of solutionas given on link below and this does not work for me

    http://www.excelforum.com/excel-prog...ml#post3932754
    Solution on this link does not work for formula with more than 255 characters

    http://dailydoseofexcel.com/archives...comment-694109
    Solution on this link gives me error: 'application-defined or object-defined '

    here is my formula:

    Worksheets("WorkSheet1").Range("B1:B12").FormulaArray = "=IF(ISERROR(MEDIAN(IF(WorkSheet!R2C4:R10000C4=R50C2,IF(WorkSheet!R2C7:R10000C7=R51C2,IF(WorkSheet!R2C12:R10000C12=RC1,IF(WorkSheet!R2C18:R10000C18=R2C17,WorkSheet!R2C13:R10000C13)))))),0,MEDIAN(IF(WorkSheet!R2C4:R10000C4=R50C2,IF(WorkSheet!R2C7:R10000C7=R51C2,IF(WorkSheet!R2C12:R10000C12=RC1,IF(WorkSheet!R2C18:R10000C18=R2C17,WorkSheet!R2C13:R10000C13))))))"

    Any help in this is highly appreciated.....

    Thanks,
    -N

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: FormulaArray does not work for more than 255 characters

    It says in the help.

    The FormulaArray property also has a character limit of 255.

    So be a bit creative and reduce the size of the formula. You can replace the range references with named ranges.

    Worksheets("WorkSheet1").Range("B1:B12").FormulaArray = "=IF(ISERROR(MEDIAN(IF(DATA1,IF(DATA2=R51C2,IF(DATA3=RC1,IF(DATA4=R2C17,DATA5)))))),0,MEDIAN(IF(DATA1=R50C2,IF(DATA2=R51C2,IF(DATA3=RC1,IF(DATA4=R2C17,DATA5))))))"

    You can even create the named ranges on the fly and then replace them in the formula for the full reference once the array formula is in place.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    12-02-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    74

    Re: FormulaArray does not work for more than 255 characters

    Thanks Andy,

    Yeah I knew FormulaArray has 255 character limitation and hence this post. I don't 100% agree to your creative approach as even after creating name ranges on the fly , the formula length might very well go beyond 255 characters.

    I am looking for long term solution mate

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: FormulaArray does not work for more than 255 characters

    As I said, "You can even create the named ranges on the fly and then replace them in the formula for the full reference once the array formula is in place. "

    So

    Please Login or Register  to view this content.
    Edit: Re reading your reply I see you are saying that even with reduced sections of the formula you may still exceed the limit. In that case you would need to use an alternative to a single cell formula solution.
    Last edited by Andy Pope; 12-18-2014 at 06:17 AM.

  5. #5
    Registered User
    Join Date
    12-02-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    74

    Re: FormulaArray does not work for more than 255 characters

    "In that case you would need to use an alternative to a single cell formula solution."

    Did you mean looping for each cell value? I think this will increase the execution time.

    please provide example ...

    Thanks
    -N
    Last edited by linok; 12-18-2014 at 11:29 PM.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: FormulaArray does not work for more than 255 characters

    Build a data set to perform the Median function on.

    I'm not saying it's going to be quicker but given there is no way around the 255 limit, if you have extremely long references, you have no choice.

  7. #7
    Registered User
    Join Date
    04-20-2013
    Location
    Woking, England
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    34

    Re: FormulaArray does not work for more than 255 characters

    Mike

+ 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. Delete first characters does'nt work!
    By kokos in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 01-22-2014, 09:05 AM
  2. [SOLVED] Cannot get Conditional Formatting formula to work with wildcard characters.
    By Oscar Martin in forum Excel General
    Replies: 4
    Last Post: 01-19-2014, 12:52 PM
  3. Extracting characters from a work book filename
    By jshaw82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2013, 02:10 PM
  4. FormulaArray
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-29-2011, 06:32 PM
  5. How do I get Format Wrap Text to work with greater than 255 characters
    By MartinP in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2009, 04:29 AM

Tags for this Thread

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