SUMIF in VBA

bhanu2003

Board Regular
Joined
Dec 9, 2003
Messages
76
Hi,

tried searching to see if i could avoid the post but, sorry could not find, so posting.

i want a variable to have the value of a sumif condition.

That is, say

SUMACT = SUMIF(E28:I28,"",E27:I27)

Thanks,
Bhanu :rolleyes:
 
Bhanu,

Using your data, I get 260 (as required by you) with each of the 3 macros presented. The macros works irrespective of whether the data in E27:I27 and E28:I28 is determined by a formula or result from manual input.

The following was setup to test whether the macros are effected if the data is determined by a formula:
Sumif - VBA.xls
CDEFGHI
20
21Input:2019367
22657680
23
24
25
26
27Output:  2019367
28657680  
29
30
Sheet1


E27:
=IF(E21<>"",E21,"")
Copied to I27

E28:
=IF(E22<>"",E22,"")
Copied to I28

I still get 260 (the sum of H27 and I27).

Two things to check:
1. Are you putting the macros into a standard module?
2. Do cells H28 and I28 really have no value? e.g. the cells may have conditional formatting or custom formatting that makes them appear as blank. A zero in a cell, custom formatted as a blank, is not “no value” as far as the macro is concerned. Also, check under the Tools menu | Options | View tab – ensure that the check box for “Zero values” is checked.

Regards,

Mike
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi Bhanu,

Iam a newB in this but wanted to see if this could also be a possibility, likein do we save the sheet as .xlsm to save a macro????:confused:
 
Upvote 0
Private Sub FindTotal()
With Sheets("DT Week 1")
Sheets("SEPTEMBER").Range("L5:L23").Value = _
WorksheetFunction.SumIfs(.Range("B:B"), _
_
.Range("G:G"), "=Fasiuddin Md" & .Range("L5").Value)
End With
End Sub
I am trying this in VBA but returning "0",Please help on this,I am very new to VBA.
I have names and time in DT week 1(sheet name) and result should be appear in SEPTEMBER(Sheet name)
Any help is appreciated,

Thanks in advance,
Ch Nagaraju
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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