+ Reply to Thread
Results 1 to 8 of 8

Long FormulaArray

  1. #1
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Long FormulaArray

    I have a FormulaArray that I am trying to use but it is over the 255 character limit.

    The FormulaArray as it should appear in a cell is:

    =IF(MAX(IF(A3=Results!A$2:INDEX(Results!$1:$65526, COUNTA(Results!$A:$A), 1),Results!F$2:INDEX(Results!$1:$65526, COUNTA(Results!$F:$F), 6)))=0,"",MAX(IF(A3=Results!A$2:INDEX(Results!$1:$65526, COUNTA(Results!$A:$A), 1),Results!F$2:INDEX(Results!$1:$65526, COUNTA(Results!$F:$F), 6))))

    However they are two spots where I need to use a variable (bolded/underlined in the example above).

    This was the formula as I was trying to use it:
    Please Login or Register  to view this content.
    How can I get around this?

  2. #2
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Re: Long FormulaArray

    One way to trim characters would be to simply shorten the length of your sheet/variable names (e.g. varNextRow > NxtR or Results > Res)
    Another way would be to split the text of the FormulaArray into two, and pass each to a separate variable (e.g. Var1 = "IF(MAX..." and Var2 = ",MAX(IF..."), and then make
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Re: Long FormulaArray

    When I try your code above (with the variables populated) I get an error:

    Run-time error '1004':
    Unable to set the FormulaArray property of the Range class

  4. #4
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Re: Long FormulaArray

    I see. You may have to do something like this then
    http://dailydoseofexcel.com/archives...rmulas-in-vba/

    Where you write a pseudo-function at the end of the first half, and replace it with the second half

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Long FormulaArray

    The OP dynamic ranges could be made Named ranges, which would shorten the formula considerably.

    On a side note: INDEX(Results!$1:$65526, COUNTA(Results!$F:$F), 6) could also be expressed as
    INDEX(Results!$F$1:$F$65526, COUNTA(Results!$F:$F), 1)

    Which would speed execution by making the formula less volatile. As written, the entire sheet is a precedent for the expression, essentially making the INDEX a volatile function. The re-fourmulation makes only column F (plus column A for the whole formula) the precedent.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Re: Long FormulaArray

    Thanks. I didn't write the formula, it was something that came in a spreadsheet we got from a vendor. I'm having trouble splitting up the formula so that it works with the replace method - I think with the character limit it would have to be broken into three sections? Is there another way where I could put the who formula in a different cell and then use that cell to make the array in the actual cell?

  7. #7
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Re: Long FormulaArray

    Splitting it up like this actually seems to work.
    Please Login or Register  to view this content.
    I believe the correct formula appears in cell "A1"
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Re: Long FormulaArray

    But that doesn't use .FormulaArray

+ 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. .FormulaArray causes Run Time Error 1004, Unable to set the FormulaArray property
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2017, 03:12 PM
  2. [SOLVED] .FormulaArray =
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-20-2016, 09:49 AM
  3. How to make Long FormulaArray macro to work? :(
    By Dahlia in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-12-2016, 08:50 PM
  4. [SOLVED] =IF and =SUMIF formulas creating long long long data processing times.
    By comp in forum Excel Programming / VBA / Macros
    Replies: 32
    Last Post: 03-26-2014, 02:59 PM
  5. long formula to vba macro - error 1004 unable to set formulaarray property
    By desibabuji in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2013, 06:18 AM
  6. VBA FormulaArray
    By jadown in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2013, 11:52 AM
  7. Using FormulaArray in VBA
    By marcelobf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2006, 04:50 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