+ Reply to Thread
Results 1 to 11 of 11

Array Formula within Macro not running

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Array Formula within Macro not running

    I keep getting the "Unable to set FormulaArray property of the Range class error" error when trying to run the below macro. It's an array formula. Is it because it's over 256 characters? Any way of fixing it so it runs?

    Sub Ftest()
    
    Sheets("Seniors").Select
    
    Range("ES3").Select
        Selection.FormulaArray = "=IFERROR(IF(IFERROR(MATCH(1,IF(RC[599]:RC[678]<>0,IF(RC[599]:RC[678]<>"""",1)),0),99)<"
    Last edited by ScabbyDog; 01-24-2016 at 01:52 PM.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Array Formula within Macro not running

    Hi ScabbyDog
    Here's a sample of what you can do (split the formula into two parts) .Here's an example and you can change to suit your array formula
    Sub Test()
        Dim Part1 As String
        Dim Part2 As String
        
        '=IF(COUNTIFS(A13:A51,">="&$D$3,A13:A51,"<" & $E$3,C13:C51,$E$5)>0,IF($D$5="Last",MAX(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51)))),MIN(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51))))),"Not Found")
        '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        Part1 = "=IF(COUNTIFS(A13:A51,"">=""&$D$3,A13:A51,""<"" & $E$3,C13:C51,$E$5)>0," & "X_X_X())"
                             
        Part2 = "IF($D$5=""Last"",MAX(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51)))),MIN(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51))))),""Not Found"")"
           
        With Sheets("Seniors").Range("ES3")
            .FormulaArray = Part1
            .Replace "X_X_X())", Part2
        End With
    End Sub
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Array Formula within Macro not running

    Quote Originally Posted by YasserKhalil View Post
    Hi ScabbyDog
    Here's a sample of what you can do (split the formula into two parts) .Here's an example and you can change to suit your array formula
    Sub Test()
        Dim Part1 As String
        Dim Part2 As String
        
        '=IF(COUNTIFS(A13:A51,">="&$D$3,A13:A51,"<" & $E$3,C13:C51,$E$5)>0,IF($D$5="Last",MAX(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51)))),MIN(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51))))),"Not Found")
        '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        Part1 = "=IF(COUNTIFS(A13:A51,"">=""&$D$3,A13:A51,""<"" & $E$3,C13:C51,$E$5)>0," & "X_X_X())"
                             
        Part2 = "IF($D$5=""Last"",MAX(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51)))),MIN(IF(A13:A51>=$D$3,IF(A13:A51<$E$3,IF(C13:C51=$E$5,A13:A51))))),""Not Found"")"
           
        With Sheets("Seniors").Range("ES3")
            .FormulaArray = Part1
            .Replace "X_X_X())", Part2
        End With
    End Sub
    Mhmm not working for me. For some reason I can't post the whole array formula here without a firewall intervening! Will attach sample book below.
    Last edited by ScabbyDog; 01-24-2016 at 02:52 PM. Reason: Linking to another post

  4. #4
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Array Formula within Macro not running

    My next post will contain sample workbook with the array formula inside.
    Last edited by ScabbyDog; 01-24-2016 at 02:52 PM. Reason: Rules

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Array Formula within Macro not running

    Can you post a sample workbook ...?
    No need for duplicate threads (this is forbidden : Cross-Post)

  6. #6
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Array Formula within Macro not running

    Final-Sample1.xlsm

    Sample attached with code in macro. If someone can get it to run so that it puts the array formula in the cell then that's all I need!

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Array Formula within Macro not running

    May be the Test sub will do the task
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Array Formula within Macro not running

    Unfortunately not Yasser. Needs to be an array and all that does is return #VALUE!

  9. #9
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Array Formula within Macro not running

    Not even sure what that Evaluate formula you sent me does Yasser?

  10. #10
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Array Formula within Macro not running

    Anyone else able to help me out with the sample workbook?

  11. #11
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Array Formula within Macro not running

    Your sample is not the required .. I need a sample workbook with the array formula in the spreadsheet itself to try to offer help

+ 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] Running Error If then else formula in Macro
    By cvishu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2014, 02:25 PM
  2. #REF Error in Formula after running Macro
    By junijl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-18-2013, 10:27 AM
  3. Updating a full array of data from BBG while running a macro
    By blizzgrarg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 01:40 AM
  4. VBA - Running Macro from array / list
    By bwhite1986 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-09-2012, 12:46 PM
  5. Macro: Running a formula/argument
    By firehousetk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2011, 02:58 PM
  6. Formula Error when running Macro
    By treeleaf20 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2009, 09:50 AM
  7. [SOLVED] formula after running a macro
    By SHIRA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2006, 04:30 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