Changing a Sumifs to a Sumproduct

Joshua Kao

New Member
Joined
Feb 14, 2021
Messages
16
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi, could someone please help me convert the sumifs formula in VBA, to a sumproducts please? Thank you.

ActiveCell.FormulaR1C1 = _
"=SUMIFS('Closing Stock.xlsx'!C3,'Closing Stock.xlsx'!C1,RC[-4])"
 
Ok, how about
VBA Code:
   Dim Pth As String
   Pth = Environ("userprofile")
   
   irow = Cells(Rows.Count, 1).End(xlUp).Row
   Range("E2:E" & irow).FormulaR1C1 = _
        "=SUMPRODUCT(('" & Pth & "\Desktop\PHMG\Stock Take\PS\[Closing Stock.xlsx]closing stock-PS'!R2C3:R1000C3)*('" & Pth & "\Desktop\PHMG\Stock Take\PS\[Closing Stock.xlsx]closing stock-PS'!R2c1:R1000C1=rc[-4]))"
    Range("F2:F" & irow).FormulaR1C1 = _
        "=SUMIFS(Master!C[-3],Master!C[-5],ComparisonM2K!RC[-5],Master!C[-2],ComparisonM2K!RC[-3])"
    Range("G2:G" & irow).FormulaR1C1 = "=(RC[-2]/RC[-1])*100-100"
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
If you select a cell with the formula in it & look at the formula bar, is the formula correct?
 
Upvote 0
oh nvm i forgot to change it from R2 to R3, the data starts from row 3 in the closing stock.
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,988
Members
448,935
Latest member
ijat

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