Combining working .FormulaArray to working formula

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
723
Office Version
  1. 2016
Platform
  1. Windows
I have two formulas that I am trying to put together. They work on their own, but not when put together. What am I missing?

Excel Formula:
Range("B4").FormulaArray = "=(SUM(--(MMULT(--IF((" & subarea & "=RIGHT(A4,3))*(" & dept & "=""SA""),(" & qtr & "=""N""),0),TRANSPOSE(COLUMN(" & qtr & ")^0))>0)))"
and
Excel Formula:
Range("B7") = "=ROUNDDOWN(1-(B4/(COUNTIFS(" & dept & ",""SA""," & subarea & ",RIGHT(A4,3)))),2)"
I would have thought this -
Excel Formula:
Range("B7").FormulaArray = "=ROUNDDOWN(1-((SUM(--(MMULT(--IF((" & subarea & "=RIGHT(A4,3))*(" & dept & "=""SA""),(" & qtr & "=""N""),0),TRANSPOSE(COLUMN(" & qtr & ")^0))>0)))/(COUNTIFS(" & dept & ",""SA""," & subarea & ",RIGHT(A4,3)))),2)"
But I get "Unable to set FormulaArray property of the Range class"

Thank you
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Best guess would be that one of the variables is not valid. Try removing the = sign at the start of the formula so that it is entered into the cell as a text string, or using debug.print to show it in the immediate pane. That might make it easier to find the problem.
 
Upvote 0
Best guess would be that one of the variables is not valid. Try removing the = sign at the start of the formula so that it is entered into the cell as a text string, or using debug.print to show it in the immediate pane. That might make it easier to find the problem.
I tried that, everything looks right. On their own, both formulas work perfectly. When combined, they don't. I don't understand why this is.
 
Upvote 0
I tried that, everything looks right.
It might look right but if it actually was right then it would work, it might not give you the result you expect but it would still enter into the cell.

edit:- Try wrapping the whole formula in IFERROR so that it will return a blank if the formula evaluates to any kind of error.
 
Upvote 0
Interesting, but I'm under the limit. If I take out the "=" and run it I get

Excel Formula:
ROUNDDOWN(1-((SUM(--(MMULT(--IF((Employees!C4:C5000=RIGHT(A4,3))*(Employees!H4:H5000="SA"),(Employees!K4:N5000="N"),0),TRANSPOSE(COLUMN(Employees!K4:N5000)^0))>0)))/(COUNTIFS(Employees!H4:H5000,"SA",Employees!C4:C5000,RIGHT(A4,3)))),2)

If I break it up where it does work I have the following:

B4 =
Excel Formula:
(SUM(--(MMULT(--IF((Employees!C4:C5000=RIGHT(A4,3))*(Employees!H4:H5000="SA"),(Employees!K4:N5000="N"),0),TRANSPOSE(COLUMN(Employees!K4:N5000)^0))>0)))
Excel Formula:
ROUNDDOWN(1-(B4/(COUNTIFS(Employees!H4:H5000,"SA",Employees!C4:C5000,RIGHT(A4,3)))),2)
 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,098
Members
449,205
Latest member
ralemanygarcia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top