Sumifs and Do While Loops - Help Needed

seanshurbet1

New Member
Joined
Mar 21, 2019
Messages
4
Hey -

So created t following code trying to mimic this formula ** =SUMIFS(OOR_Data!$L:$L,OOR_Data!$Q:$Q,"="&FF4_FF2!J$5,OOR_Data!$H:$H,FF4_FF2!$C9)

Code:
 i = 6


Do While Range("C" & i) <> ""

Set MyRg1 = Sheets("OOR_Data").Range("L:L")
Set MyRg2 = Sheets("OOR_Data").Range("Q:Q")
Set MyRg3 = Sheets("OOR_Data").Range("H:H")
Set MyRg4 = Sheets("FF4_FF2").Range("C" & i)
Set MyRg5 = Sheets("FF4_FF2").Range("I$5")

Range("I6:N" & i).Formula = Application.WorksheetFunction.SumIfs(MyRg1, MyRg2, " = " & MyRg5) & Application.WorksheetFunction.SumIfs(MyRg1, MyRg3, MyRg4)

i = i + 1

Loop[\code]

&

[code]'i = 6
'Do While Range("B" & i) <> ""
'Range("I6:N" & i) = Application.WorksheetFunction.SumIfs(Sheets("OOR_Data").Range("L:L"), Sheets("OOR_Data").Range("Q:Q"), " = " & Sheets("FF4_FF2").Range("I" & b), Sheets("OOR_Data").Range("H:H"), Sheets("FF4_FF2").Range("C" & i))
' SumProduct((Sheets("OOR_Data").Range("H3:H10000") = Sheets("FF4_FF2").Range("C" & i)) * (Sheets("OOR_Data").Range("R2:R10000") = Sheets("FF4_FF2").Range("I" & b)), (Sheets("OOR_Data").Range("L2:L10000")))

'i = i + 1


'Loop[\code]
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

seanshurbet1

New Member
Joined
Mar 21, 2019
Messages
4
Sorry - I messed up the code tags - but basically I am saying go to ws x and sum qty and next look at same page with dates is column q and = to ws y date "n row" and match the items in ws x to ws y

The formula works
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,113
Messages
5,835,456
Members
430,357
Latest member
Greshapa

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
Top