+ Reply to Thread
Results 1 to 8 of 8

Converting Array Formula into VBA returns an error

  1. #1
    Registered User
    Join Date
    07-18-2014
    Location
    Atlanta, GA
    MS-Off Ver
    10
    Posts
    65

    Converting Array Formula into VBA returns an error

    I have looked around the web and it appears if my array formula is too long to run inside VB. I am getting the "Unable to set the formulaarray Property" error message
    Unfortunately I have no clue how to re-write this in order for it to work
    The Formula is:
    Please Login or Register  to view this content.
    The idea is to the formula to run and the procedure to finish up in the following manner

    Please Login or Register  to view this content.
    Any assistance is GREATLY appreciated!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Converting Array Formula into VBA returns an error

    Hello HJHamm,

    Can you decrypt what this array formula is doing in words?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-18-2014
    Location
    Atlanta, GA
    MS-Off Ver
    10
    Posts
    65

    Re: Converting Array Formula into VBA returns an error

    Leith I will do the best I can!
    I have 3 levels of hiearchy I have to check represented by the if statement checking to see if the cells in question in column D are blank.
    If level 3 (D4) is blank and level 2 (D3) is blank then I need to find the store number in Column A on Sheet called Rostered by Matching the the level 1 Regional store sort order (Column P:P and cell A11) as well as the Region Name (Column H:H and cell D2)... now working this backwards to level 2 I am indexing the same set of store numbers in Column A, but matching it by different criteria; Area Store Sort Order (Column O:O and cell A11) as well as the Area Name (Column K:K and cell D3). Lastly, indexing the same set of store numbers, but this time I need to match it by Territory Store Sort Order (Column N:N and cell A11) and Territory Name (Column D:D and cell D4).
    Does this help explain it any better?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Converting Array Formula into VBA returns an error

    As a hack, your code could rename worksheet Rostered to just R, insert the formula ...

    =IF(D$4="", IF(D$3="",
    INDEX(R!A:A, MATCH(1, R!P:P=Worksheet!A11 * R!H:H=Worksheet!D$2,0)),
    INDEX(R!A:A, MATCH(1, R!O:O=Worksheet!A11)*(R!K:K=Worksheet!D$3),0)),
    INDEX(R!A:A, MATCH(1, R!N:N=Worksheet!A11 * R!D:D=Worksheet!D$4,0)))

    Then change it back.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    07-18-2014
    Location
    Atlanta, GA
    MS-Off Ver
    10
    Posts
    65

    Re: Converting Array Formula into VBA returns an error

    shg... unfortunately the hack doesn't work, it appears as I am still over the max...

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Converting Array Formula into VBA returns an error

    Not by my reckoning; with the change, it's 234 characters, and the limit is 255.

  7. #7
    Registered User
    Join Date
    07-18-2014
    Location
    Atlanta, GA
    MS-Off Ver
    10
    Posts
    65

    Re: Converting Array Formula into VBA returns an error

    Finally after several attempts I have it working now... SHG used your idea and kept trimming things down. I would like to keep this open for awhile longer in order to see if anyone can tell me a "straight VBA" line of code that will do the same thing as I may very well run into this situation again and a "qucik fix" will not work... Say for example is I had to do 4 index(match)(match) I would be in trouble
    Last edited by HJHamm; 12-23-2014 at 09:09 AM.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Converting Array Formula into VBA returns an error

    Here is a function that inserts long array formulas.

    Please Login or Register  to view this content.
    Here's an example that demonstrates:

    Please Login or Register  to view this content.
    Last edited by shg; 12-23-2014 at 12:34 PM.

+ 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] If formula that returns a value from an associated column array
    By ensmith in forum Excel General
    Replies: 3
    Last Post: 06-29-2012, 12:26 PM
  2. Converting 3x10 array to a 1X30 array to run a Match formula
    By NBVC in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-08-2009, 07:45 AM
  3. Array formula returns a 0, but I don't want it to
    By keys in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-08-2008, 07:29 PM
  4. Combo Box returns from array formula
    By robcosta in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-22-2008, 03:33 PM
  5. Array formula returns 0
    By erict in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-24-2007, 02:23 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