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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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,216,129
Messages
6,129,047
Members
449,482
Latest member
al mugheen

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