Vba Formula Array Calc

bendy315

New Member
Joined
Dec 21, 2009
Messages
7
Trying to calculate the percentage of projects meeting the target for each year. Here's what I came up with. Maybe there is a better way to do this, but I need it to work dynamically with changing data. What I have so far doesn't seem to return anything, just a null value...

'P-Std Calc
Range("H" & rwc).Select
Selection.FormulaArray = _
"=COUNTIFS(L2:L" & LastRow & ","" = """ & year & """"",AC2:AC" & LastRow & ","" <= """ & std & """"") / & count & "

Here's the Data...
[TABLE="width: 500"]
<tbody>[TR]
[TD]Year[/TD]
[TD]Hrs[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]530[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]1,106[/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]80[/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]486[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]687[/TD]
[/TR]
</tbody>[/TABLE]


In this case year = 15, lastrow = 6, std = 700, and count =2, so should return 50% of projects in '15 beat the target.
 
Not tested, but this seems fine to me
str = "=COUNTIFS($L$2:$L$@LR,""=""&@YR,$AC$2:$AC$@LR,""<=""&@std)/@count"

M.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Ignore everything I said, you're right and it's what I had originally posted - too many speech marks and confusing myself!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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