sumif from another worksheet excel vba

curious K

New Member
Joined
Dec 28, 2015
Messages
22
I've worksheet "summary" & "ExpLedgers"

ExpLedgers having 8 columns

The 8th no. column i.e. column H having Ledgers GroupCode
I want sum of 6th column (Column F) to store in variable


DataArr(R1, 1) --> Group code store in this array e.g. here it is 16

for this I use following function but it gives an Run-time error '13' Type mismatch

WorksheetFunction.SumIf(Sheets("ExpLedgers").Range("$F:$F"), Sheets("ExpLedgers").Range("$H:$H"), DataArr(R1, 1))
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi.

The syntaxes for SUMIF and SUMIFS are annoyingly inconsistent.

With SUMIF, it's:

=SUMIF(range, criteria, [sum_range])


Looks like you might have these in the wrong order.

Regards
 
Upvote 0
Yes after change accordingly it works!

WorksheetFunction.SumIf(Sheets("ExpLedgers").Range("$H:$H"), DataArr(R1, 1), Sheets("ExpLedgers").Range("$F:$F"))

Thanks.
 
Upvote 0

Forum statistics

Threads
1,215,669
Messages
6,126,125
Members
449,293
Latest member
yallaire64

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