# How to Use VBA Sumifs with Multiple Criteria in Same Column

Get FREE Advanced Excel Exercises with Solutions!

Excel is the most widely used tool for dealing with massive datasets. We can perform myriads of tasks of multiple dimensions in Excel. In this article, I will show you how to use VBA Sumifs with multiple criteria in the same column.

## Use VBA Sumifs with Multiple Criteria in Same Column: 3 Easy Steps

This is the dataset for today’s article. There are some orders with the Price. I will calculate the price if the product is Mobile or AC. The SUMIFS function is useful here. However, I will illustrate how to use Sumifs using VBA macro here. ### Step 1: Create New Module in Visual Basic Window

The first step is to create a new module.

• First of all, go to the Developer.
• Then, select Visual Basic. • A VBA window will appear. Go to the Insert.
• After that, select Module. • Excel will create a new module. ### Step 2: Write Down VBA Macro Code

The next step is to write down the VBA code. For this,

• Go to the new module and write down the following code
``````Sub Sumifs_same_column_multiple_criteria()
Total = 0
'Apply For loop
For n = 5 To 11
If Range("C" & n) = "Mobile" Or Range("C" & n) = "AC" Then
Total = Total + Range("D" & n)
End If

Next n
'Show Result
Range("C13") = Total
End Sub`````` Code Breakdown:

• First of all, I have created a sub-procedure Sumifs_same_column_multiple_criteria()
• Then, I set the value for Total to be 0.
• After that, I applied a For loop for the Total.
• Then, I set the criteria using the IF statement
• n defines the row number here.
• Finally, I showed the result in C13.

### Step 3: Run VBA Macro to Apply Multiple Criteria in Same Column

Finally, I will run the VBA macro. To do so,

• Select the icon (see the image below). • Excel will run the code and show the result. ## Things to Remember

• You can press ALT+F11 to bring the Visual Basic Window.
• You can press F5 to run the code.

## Conclusion

In this article, I have explained how to use VBA Sumifs with multiple criteria in the same column. I hope it helps everyone. If you have any suggestions, ideas, or feedback, please feel free to comment below.

## Related Articles Akib Bin Rashid

Hi, this is MD Akib Bin Rashid. I completed my BSc in Engineering back in 2019. After that, I did an MBA. Then, I joined as an Excel and VBA Content Developer at SOFTEKO Digital. Being passionate about data analytics and finance, I will try to assist you with Excel

We will be happy to hear your thoughts Advanced Excel Exercises with Solutions PDF  