SUMIFS with 3 criteria in Userform- Excel VBA

CakzPrimz

Board Regular
Joined
Oct 6, 2017
Messages
57
Dear Folks,

I need your help, I'm trying to get the extract the number based on multiple criteria in a userform with SUMIFS from a certain period.

UserForm name = UserForm3

Code:
Private Sub ComboBox3_Change

    Dim S_Date As Date 'Start Date
    Dim E_Date As Date 'End Date

    Set S_Date = UserForm3.ComboBox1.Value
    Set E_Date = UserForm3.ComboBox2.Value

End Sub

Train3_Actual.Value = Application.WorksheetFunction.SumIfs(Sheet1.Range("E3:E842"), Sheet1.Range("B3:B842"), " >= " & S_Date, Sheet1.Range("B3:B842"), " <= " & E_Date, "T - TRAIN 3")

It says, "Object required". I

Thanks in advance.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Code:
Private Sub ComboBox3_Change

    Dim S_Date As Date 'Start Date
    Dim E_Date As Date 'End Date

    Set S_Date = UserForm3.ComboBox1.Value
    Set E_Date = UserForm3.ComboBox2.Value

[FONT=Verdana]      Train3_Actual.Value = Application.WorksheetFunction.SumIfs(Sheet1.Range("E3:E842"), Sheet1.Range("B3:B842"), " >= " & S_Date, Sheet1.Range("B3:B842"), " <= " & E_Date, "T - TRAIN 3")[/FONT]

End Sub
 
Upvote 0
The first code below give no error, but the value is 0, the correct value is 18,000

Code:
Private Sub ComboBox3_Change()
    Dim S_Date As Date
    Dim E_Date As Date
    
    S_Date = Me.ComboBox1.Value
    E_Date = Me.ComboBox2

Train3_Actual.Value = Application.WorksheetFunction.SumIfs(Sheet1.Range("E3:E842"), Sheet1.Range("B3:B842"), " >= " & Sheet11.Range("AA11").Value, Sheet1.Range("B3:B842"), " <= " & Sheet11.Range("AB11").Value, Sheet1.Range("C3:C842"), "T - TRAIN 3").Value

The second code resulting Runtime error '1004'
Unable to get the Sumifs property of the WorkshetFunction class

Code:
Train3_Actual.Value = Application.WorksheetFunction.SumIfs(Sheet1.Range("E3:E842"), Sheet1.Range("B3:B842"), " >= " & CLng(S_Date), Sheet1.Range("B3:B842"), " <= " & CLng(E_Date), "T - TRAIN 3")


The third code resulting Runtime error '1004'
Unable to get the Sumifs property of the WorkshetFunction class

Code:
Train3_Actual.Value = Application.WorksheetFunction.SumIfs(Sheet1.Range("E3:E842"), Sheet1.Range("B3:B842"), "" >= "" & S_Date, Sheet1.Range("B3:B842"), "" <= "" & E_Date, "T - TRAIN 3")
 
Upvote 0
When I try to write the formula in the sheet as below:

=SUMIFS(Backfill[ACTUAL],Backfill[DATE],">="&$AA$11,Backfill[DATE],"<="&$AB$11,Backfill[AREA],Z11)

It gave me the right answer.

Will somebody help me please, I have completely lost.

Thank you
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,442
Members
448,898
Latest member
drewmorgan128

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