Sumifs vba

Skagga5

New Member
Joined
May 23, 2013
Messages
11
Hi

I am trying to do a SUMIFS in VBA. The below code works just perfect if I hardcode the arguments -


Sub Ageingformulas2()

Dim Customer As Range
Dim Bucket As Range
Dim Amount_GBP As Range

Set Customer = Sheets("K135512002").Range("G:G")
Set Bucket = Sheets("K135512002").Range("K:K")
Set Amount_GBP = Sheets("K135512002").Range("I:I")

With Sheets("K135512002")
Sheets("Mapping Table").Range("B13").Value = Application.WorksheetFunction.SumIfs(Amount_GBP, Customer, UK_BKKOREA, Bucket, 0-90 days)
End With

End Sub


When I change the code UK_BKKOREA to the value of Cell A13 and 0-90 days to Cell B12 it gives me a zero value.

The values in A13 will always change, so I do need this argument to look up the value in A13.

Below is an example of the code that returns a zero value

Sheets("Mapping Table").Range("B13").Value = Application.WorksheetFunction.SumIfs(Amount_GBP, Customer, A13, Bucket, B12)

So effectively I want the formula to work on whatever the value is of Cell A13 and not a hardcode value.

Can you PLEASE help????
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Welcome to the board..

Try
Sheets("Mapping Table").Range("B13").Value = Application.WorksheetFunction.SumIfs(Amount_GBP, Customer, Range("A13"), Bucket, Range("B12"))
 
Upvote 0
Excellent, thank you very much!:)

I have tried something similiar ~ Range("A13").value, it obviously didn't work!
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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