SUMPRODUCT in VBA

lukasz_rz

New Member
Joined
Oct 13, 2013
Messages
48
Guys.

This is quite urgent, but I hope you can easily solve my problem.

I try to put formula:

Code:
=IF(AND(COUNTIF(AT!$B:$B;$B2)=0;$E2=List!$B$6);"X";IF(AND(COUNTIF(Closed;$E2)>0;SUMPRODUCT((AT!B:B=B2)*(AT!H:H=""))>0);"XX";""))

into VBA code like this to place that formula in multiple cells in one column:

Code:
Range("Q2:Q" & Range("B" & Rows.Count).End(xlUp).Row).FormulaR1C1 = _
 "=IF(AND(COUNTIF(AT!C2:C2,R[0]C2)=0,R[0]C5=List!R6C2),""X"",IF(AND(COUNTIF(Closed,R[0]C5)>0,[SIZE=3][B]SUMPRODUCT((AT!C2:C2=R[0]C2)*(AT!C8:C8=""""))>0)[/B][/SIZE],""XX"",""""))"

Unfortunately, the SUMPRODUCT part is causing a problem - excel is not responding when I run the macro. Any suggestions what I should modify to make that thing work?

Thx in advance!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Have you attempted using the Macro Recorder to record your formula? It will give you the R1C1 formula equivalent to the worksheet formula.

Forgive me if this is trivial. Start with our formula in the correct cell. Click the macro recorder in the lower status bar. Change a character in your formula (i.e. change the "S" in SUMPRODUCT to a lower case "s".) Stop the recorder and view the newly created VBA Code.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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