VBA - Array Formula : Run Time Error 1004 on formulaArray even though the formula looks right. Example inside











up vote
1
down vote

favorite












EDIT: The solution from Chronocidal was very helpful. I implemented it and it works like a charm. Thanks to all your help. The remarks from Ron Reisenfeld and EvR helped a lot too and sent me in the right direction



can somebody help me with an array formula I am trying to insert into some cells with the formula.local function? There is probably something not right in the formula, but I just can’t find the reason… It would be a great help if someone can test it, since I only have a german version of excel and it may be possible that I have overseen any language specific reasons. I attached a file to test the formula (xlsx)



If I debug.print the formula looks like this:



=(PRODUCT(IF(Daten!B1:B12353=SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353,999999),1),Daten!A1:A12353-SUM(0,0),1),IF((Daten!B1:B12353>SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353),1))*((Daten!B1:B12353<=$D$33)),Daten!A1:A12353,1))^(1/(DAYS360($C$25,$D$33)/360))-1)*100


I used the formula in this example workbook: https://drive.google.com/open?id=1xCth5vo6G82lNDsclbj3FpUfYzvXsuEJ



In VBA the formula consists of plenty of variables those are:



[edit] b = last row in the range i want to look at in the formula [/edit]



Daten!B1:B" & b = Row of Dates



sh_Ov.Cells(int_Ende + 1, Int_links).Address = Latest date



sh_Ov.Cells(int_Start, 3).Address = earliest date (but not necessarily in the date row – that’s why I am working with the “small” formula)



Daten!A1:A" & b = Numbers I want to calculate the product of



ThisWorkbook.Sheets(1).Cells(x,y).FormulaArray = "=(PRODUCT(IF(Daten!B1:B" & b & "=SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & ",999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((Daten!B1:B" & b & ">SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & "),1))*((Daten!B1:B" & b & "<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"


It would be great if anyone can have a look at this. So far I am not able to find the reason



Best regards
Jens










share|improve this question









New contributor




Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Damn! It is supposed to say formula.array in the title.... -.- Sorry
    – Jens
    14 hours ago










  • .FormulaLocal is not the same as .FormulaArray. Did you mean .FormulaArray throughout your question as well as title? And what are the values of the variables you are using in the formula e.g. b ?
    – QHarr
    13 hours ago












  • Hi, yes. It was supposed to be Formulaarray in the whole post. Sorry I messed it up. b stands for the last row in the range i want to look at in the formula
    – Jens
    13 hours ago












  • Have you got it working as an array formula in a cell? You can also use edit to update your question so no problem there!
    – QHarr
    13 hours ago








  • 1




    See Entering long array formulas in vba
    – Ron Rosenfeld
    11 hours ago















up vote
1
down vote

favorite












EDIT: The solution from Chronocidal was very helpful. I implemented it and it works like a charm. Thanks to all your help. The remarks from Ron Reisenfeld and EvR helped a lot too and sent me in the right direction



can somebody help me with an array formula I am trying to insert into some cells with the formula.local function? There is probably something not right in the formula, but I just can’t find the reason… It would be a great help if someone can test it, since I only have a german version of excel and it may be possible that I have overseen any language specific reasons. I attached a file to test the formula (xlsx)



If I debug.print the formula looks like this:



=(PRODUCT(IF(Daten!B1:B12353=SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353,999999),1),Daten!A1:A12353-SUM(0,0),1),IF((Daten!B1:B12353>SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353),1))*((Daten!B1:B12353<=$D$33)),Daten!A1:A12353,1))^(1/(DAYS360($C$25,$D$33)/360))-1)*100


I used the formula in this example workbook: https://drive.google.com/open?id=1xCth5vo6G82lNDsclbj3FpUfYzvXsuEJ



In VBA the formula consists of plenty of variables those are:



[edit] b = last row in the range i want to look at in the formula [/edit]



Daten!B1:B" & b = Row of Dates



sh_Ov.Cells(int_Ende + 1, Int_links).Address = Latest date



sh_Ov.Cells(int_Start, 3).Address = earliest date (but not necessarily in the date row – that’s why I am working with the “small” formula)



Daten!A1:A" & b = Numbers I want to calculate the product of



ThisWorkbook.Sheets(1).Cells(x,y).FormulaArray = "=(PRODUCT(IF(Daten!B1:B" & b & "=SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & ",999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((Daten!B1:B" & b & ">SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & "),1))*((Daten!B1:B" & b & "<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"


It would be great if anyone can have a look at this. So far I am not able to find the reason



Best regards
Jens










share|improve this question









New contributor




Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Damn! It is supposed to say formula.array in the title.... -.- Sorry
    – Jens
    14 hours ago










  • .FormulaLocal is not the same as .FormulaArray. Did you mean .FormulaArray throughout your question as well as title? And what are the values of the variables you are using in the formula e.g. b ?
    – QHarr
    13 hours ago












  • Hi, yes. It was supposed to be Formulaarray in the whole post. Sorry I messed it up. b stands for the last row in the range i want to look at in the formula
    – Jens
    13 hours ago












  • Have you got it working as an array formula in a cell? You can also use edit to update your question so no problem there!
    – QHarr
    13 hours ago








  • 1




    See Entering long array formulas in vba
    – Ron Rosenfeld
    11 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











EDIT: The solution from Chronocidal was very helpful. I implemented it and it works like a charm. Thanks to all your help. The remarks from Ron Reisenfeld and EvR helped a lot too and sent me in the right direction



can somebody help me with an array formula I am trying to insert into some cells with the formula.local function? There is probably something not right in the formula, but I just can’t find the reason… It would be a great help if someone can test it, since I only have a german version of excel and it may be possible that I have overseen any language specific reasons. I attached a file to test the formula (xlsx)



If I debug.print the formula looks like this:



=(PRODUCT(IF(Daten!B1:B12353=SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353,999999),1),Daten!A1:A12353-SUM(0,0),1),IF((Daten!B1:B12353>SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353),1))*((Daten!B1:B12353<=$D$33)),Daten!A1:A12353,1))^(1/(DAYS360($C$25,$D$33)/360))-1)*100


I used the formula in this example workbook: https://drive.google.com/open?id=1xCth5vo6G82lNDsclbj3FpUfYzvXsuEJ



In VBA the formula consists of plenty of variables those are:



[edit] b = last row in the range i want to look at in the formula [/edit]



Daten!B1:B" & b = Row of Dates



sh_Ov.Cells(int_Ende + 1, Int_links).Address = Latest date



sh_Ov.Cells(int_Start, 3).Address = earliest date (but not necessarily in the date row – that’s why I am working with the “small” formula)



Daten!A1:A" & b = Numbers I want to calculate the product of



ThisWorkbook.Sheets(1).Cells(x,y).FormulaArray = "=(PRODUCT(IF(Daten!B1:B" & b & "=SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & ",999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((Daten!B1:B" & b & ">SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & "),1))*((Daten!B1:B" & b & "<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"


It would be great if anyone can have a look at this. So far I am not able to find the reason



Best regards
Jens










share|improve this question









New contributor




Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











EDIT: The solution from Chronocidal was very helpful. I implemented it and it works like a charm. Thanks to all your help. The remarks from Ron Reisenfeld and EvR helped a lot too and sent me in the right direction



can somebody help me with an array formula I am trying to insert into some cells with the formula.local function? There is probably something not right in the formula, but I just can’t find the reason… It would be a great help if someone can test it, since I only have a german version of excel and it may be possible that I have overseen any language specific reasons. I attached a file to test the formula (xlsx)



If I debug.print the formula looks like this:



=(PRODUCT(IF(Daten!B1:B12353=SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353,999999),1),Daten!A1:A12353-SUM(0,0),1),IF((Daten!B1:B12353>SMALL(IF((Daten!B1:B12353>=$C$25),Daten!B1:B12353),1))*((Daten!B1:B12353<=$D$33)),Daten!A1:A12353,1))^(1/(DAYS360($C$25,$D$33)/360))-1)*100


I used the formula in this example workbook: https://drive.google.com/open?id=1xCth5vo6G82lNDsclbj3FpUfYzvXsuEJ



In VBA the formula consists of plenty of variables those are:



[edit] b = last row in the range i want to look at in the formula [/edit]



Daten!B1:B" & b = Row of Dates



sh_Ov.Cells(int_Ende + 1, Int_links).Address = Latest date



sh_Ov.Cells(int_Start, 3).Address = earliest date (but not necessarily in the date row – that’s why I am working with the “small” formula)



Daten!A1:A" & b = Numbers I want to calculate the product of



ThisWorkbook.Sheets(1).Cells(x,y).FormulaArray = "=(PRODUCT(IF(Daten!B1:B" & b & "=SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & ",999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((Daten!B1:B" & b & ">SMALL(IF((Daten!B1:B" & b & ">=" & sh_Ov.Cells(int_Start, 3).Address & "),Daten!B1:B" & b & "),1))*((Daten!B1:B" & b & "<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"


It would be great if anyone can have a look at this. So far I am not able to find the reason



Best regards
Jens







excel vba excel-formula formula






share|improve this question









New contributor




Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 8 hours ago





















New contributor




Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 14 hours ago









Jens

62




62




New contributor




Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Jens is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Damn! It is supposed to say formula.array in the title.... -.- Sorry
    – Jens
    14 hours ago










  • .FormulaLocal is not the same as .FormulaArray. Did you mean .FormulaArray throughout your question as well as title? And what are the values of the variables you are using in the formula e.g. b ?
    – QHarr
    13 hours ago












  • Hi, yes. It was supposed to be Formulaarray in the whole post. Sorry I messed it up. b stands for the last row in the range i want to look at in the formula
    – Jens
    13 hours ago












  • Have you got it working as an array formula in a cell? You can also use edit to update your question so no problem there!
    – QHarr
    13 hours ago








  • 1




    See Entering long array formulas in vba
    – Ron Rosenfeld
    11 hours ago


















  • Damn! It is supposed to say formula.array in the title.... -.- Sorry
    – Jens
    14 hours ago










  • .FormulaLocal is not the same as .FormulaArray. Did you mean .FormulaArray throughout your question as well as title? And what are the values of the variables you are using in the formula e.g. b ?
    – QHarr
    13 hours ago












  • Hi, yes. It was supposed to be Formulaarray in the whole post. Sorry I messed it up. b stands for the last row in the range i want to look at in the formula
    – Jens
    13 hours ago












  • Have you got it working as an array formula in a cell? You can also use edit to update your question so no problem there!
    – QHarr
    13 hours ago








  • 1




    See Entering long array formulas in vba
    – Ron Rosenfeld
    11 hours ago
















Damn! It is supposed to say formula.array in the title.... -.- Sorry
– Jens
14 hours ago




Damn! It is supposed to say formula.array in the title.... -.- Sorry
– Jens
14 hours ago












.FormulaLocal is not the same as .FormulaArray. Did you mean .FormulaArray throughout your question as well as title? And what are the values of the variables you are using in the formula e.g. b ?
– QHarr
13 hours ago






.FormulaLocal is not the same as .FormulaArray. Did you mean .FormulaArray throughout your question as well as title? And what are the values of the variables you are using in the formula e.g. b ?
– QHarr
13 hours ago














Hi, yes. It was supposed to be Formulaarray in the whole post. Sorry I messed it up. b stands for the last row in the range i want to look at in the formula
– Jens
13 hours ago






Hi, yes. It was supposed to be Formulaarray in the whole post. Sorry I messed it up. b stands for the last row in the range i want to look at in the formula
– Jens
13 hours ago














Have you got it working as an array formula in a cell? You can also use edit to update your question so no problem there!
– QHarr
13 hours ago






Have you got it working as an array formula in a cell? You can also use edit to update your question so no problem there!
– QHarr
13 hours ago






1




1




See Entering long array formulas in vba
– Ron Rosenfeld
11 hours ago




See Entering long array formulas in vba
– Ron Rosenfeld
11 hours ago












2 Answers
2






active

oldest

votes

















up vote
1
down vote













Your formula is over 255 characters, so you cannot enter it directly via VBA.



Either change it to be shorter (such as using Named Ranges like EvR suggests), or use (technically valid) dummy code and swap it out afterwards with Range.Replace, like so:



With ThisWorkbook.Worksheets(1).Cells(x,y) 'Worksheets instead of Sheets will exclude Chart Sheets
'214 Characters
.FormulaArray = "=(PRODUCT(IF(MAX(1)=SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1),999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((MAX(1)>SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1)),1))*((MAX(1)<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"

'Swap all instances of MAX(1) for your range in the Daten sheet
.Replace("MAX(1)", "Daten!B1:B" & b, LookAt:=xlPart)
End With





share|improve this answer





















  • Nice use of replace
    – QHarr
    9 hours ago










  • Very nice use! I was splitting the formula up. The suggested way from Chronocidal is nice and easy. It worked fully when I copied it. Thank you for your help!!
    – Jens
    8 hours ago




















up vote
0
down vote













Shorten your array-formula to 255 characters (with the help of defined names) and try again. (you exceed the maximum lenght)



https://docs.microsoft.com/en-us/office/vba/api/excel.range.formulaarray






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Jens is a new contributor. Be nice, and check out our Code of Conduct.










     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203747%2fvba-array-formula-run-time-error-1004-on-formulaarray-even-though-the-formul%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    Your formula is over 255 characters, so you cannot enter it directly via VBA.



    Either change it to be shorter (such as using Named Ranges like EvR suggests), or use (technically valid) dummy code and swap it out afterwards with Range.Replace, like so:



    With ThisWorkbook.Worksheets(1).Cells(x,y) 'Worksheets instead of Sheets will exclude Chart Sheets
    '214 Characters
    .FormulaArray = "=(PRODUCT(IF(MAX(1)=SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1),999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((MAX(1)>SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1)),1))*((MAX(1)<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"

    'Swap all instances of MAX(1) for your range in the Daten sheet
    .Replace("MAX(1)", "Daten!B1:B" & b, LookAt:=xlPart)
    End With





    share|improve this answer





















    • Nice use of replace
      – QHarr
      9 hours ago










    • Very nice use! I was splitting the formula up. The suggested way from Chronocidal is nice and easy. It worked fully when I copied it. Thank you for your help!!
      – Jens
      8 hours ago

















    up vote
    1
    down vote













    Your formula is over 255 characters, so you cannot enter it directly via VBA.



    Either change it to be shorter (such as using Named Ranges like EvR suggests), or use (technically valid) dummy code and swap it out afterwards with Range.Replace, like so:



    With ThisWorkbook.Worksheets(1).Cells(x,y) 'Worksheets instead of Sheets will exclude Chart Sheets
    '214 Characters
    .FormulaArray = "=(PRODUCT(IF(MAX(1)=SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1),999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((MAX(1)>SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1)),1))*((MAX(1)<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"

    'Swap all instances of MAX(1) for your range in the Daten sheet
    .Replace("MAX(1)", "Daten!B1:B" & b, LookAt:=xlPart)
    End With





    share|improve this answer





















    • Nice use of replace
      – QHarr
      9 hours ago










    • Very nice use! I was splitting the formula up. The suggested way from Chronocidal is nice and easy. It worked fully when I copied it. Thank you for your help!!
      – Jens
      8 hours ago















    up vote
    1
    down vote










    up vote
    1
    down vote









    Your formula is over 255 characters, so you cannot enter it directly via VBA.



    Either change it to be shorter (such as using Named Ranges like EvR suggests), or use (technically valid) dummy code and swap it out afterwards with Range.Replace, like so:



    With ThisWorkbook.Worksheets(1).Cells(x,y) 'Worksheets instead of Sheets will exclude Chart Sheets
    '214 Characters
    .FormulaArray = "=(PRODUCT(IF(MAX(1)=SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1),999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((MAX(1)>SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1)),1))*((MAX(1)<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"

    'Swap all instances of MAX(1) for your range in the Daten sheet
    .Replace("MAX(1)", "Daten!B1:B" & b, LookAt:=xlPart)
    End With





    share|improve this answer












    Your formula is over 255 characters, so you cannot enter it directly via VBA.



    Either change it to be shorter (such as using Named Ranges like EvR suggests), or use (technically valid) dummy code and swap it out afterwards with Range.Replace, like so:



    With ThisWorkbook.Worksheets(1).Cells(x,y) 'Worksheets instead of Sheets will exclude Chart Sheets
    '214 Characters
    .FormulaArray = "=(PRODUCT(IF(MAX(1)=SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1),999999),1),Daten!A1:A" & b & "-SUM(0,0),1),IF((MAX(1)>SMALL(IF((MAX(1)>=" & sh_Ov.Cells(int_Start, 3).Address & "),MAX(1)),1))*((MAX(1)<=" & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")),Daten!A1:A" & b & ",1))^(1/(DAYS360(" & sh_Ov.Cells(int_Start, 3).Address & "," & sh_Ov.Cells(int_Ende + 1, Int_links).Address & ")/360))-1)*100"

    'Swap all instances of MAX(1) for your range in the Daten sheet
    .Replace("MAX(1)", "Daten!B1:B" & b, LookAt:=xlPart)
    End With






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 9 hours ago









    Chronocidal

    2,4471216




    2,4471216












    • Nice use of replace
      – QHarr
      9 hours ago










    • Very nice use! I was splitting the formula up. The suggested way from Chronocidal is nice and easy. It worked fully when I copied it. Thank you for your help!!
      – Jens
      8 hours ago




















    • Nice use of replace
      – QHarr
      9 hours ago










    • Very nice use! I was splitting the formula up. The suggested way from Chronocidal is nice and easy. It worked fully when I copied it. Thank you for your help!!
      – Jens
      8 hours ago


















    Nice use of replace
    – QHarr
    9 hours ago




    Nice use of replace
    – QHarr
    9 hours ago












    Very nice use! I was splitting the formula up. The suggested way from Chronocidal is nice and easy. It worked fully when I copied it. Thank you for your help!!
    – Jens
    8 hours ago






    Very nice use! I was splitting the formula up. The suggested way from Chronocidal is nice and easy. It worked fully when I copied it. Thank you for your help!!
    – Jens
    8 hours ago














    up vote
    0
    down vote













    Shorten your array-formula to 255 characters (with the help of defined names) and try again. (you exceed the maximum lenght)



    https://docs.microsoft.com/en-us/office/vba/api/excel.range.formulaarray






    share|improve this answer

























      up vote
      0
      down vote













      Shorten your array-formula to 255 characters (with the help of defined names) and try again. (you exceed the maximum lenght)



      https://docs.microsoft.com/en-us/office/vba/api/excel.range.formulaarray






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Shorten your array-formula to 255 characters (with the help of defined names) and try again. (you exceed the maximum lenght)



        https://docs.microsoft.com/en-us/office/vba/api/excel.range.formulaarray






        share|improve this answer












        Shorten your array-formula to 255 characters (with the help of defined names) and try again. (you exceed the maximum lenght)



        https://docs.microsoft.com/en-us/office/vba/api/excel.range.formulaarray







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 12 hours ago









        EvR

        9111311




        9111311






















            Jens is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            Jens is a new contributor. Be nice, and check out our Code of Conduct.













            Jens is a new contributor. Be nice, and check out our Code of Conduct.












            Jens is a new contributor. Be nice, and check out our Code of Conduct.















             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203747%2fvba-array-formula-run-time-error-1004-on-formulaarray-even-though-the-formul%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            Popular posts from this blog

            Guess what letter conforming each word

            Port of Spain

            Run scheduled task as local user group (not BUILTIN)