VBA SumIf returns 0 when using Double variable criteria

molotowski

New Member
Joined
Jun 16, 2015
Messages
2
The below is a simple SumIf calculation where I want to sum if >= the variable k that is declared as a Double.

This, however returns 0. If I change k for any integer, 3, 4 etc, it returns the "true" value. But if I change k for 4.23983 it returns 0.

I already tried to declare another Double variable (lets say a) and put a = sumif(...). But that gives me 0 as well. I also tried "">="& k &""" but that doesn't work either (found that on Google).

I'm very new to VBA and Excel so I might have missed some basic things out. All help is very appreciated!

Code:
Worksheets("ES").Cells(j + 10, 6).Value = Application.WorksheetFunction.SumIf(Worksheets("help").Range("A1:A4273"), ">=" & k, Worksheets("help").Range("A1:A4273"))
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

molotowski

New Member
Joined
Jun 16, 2015
Messages
2
Please let me know if there's anything I can do to make it easier for you guys to help me out!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,671
Messages
5,838,694
Members
430,564
Latest member
Raeyven

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
Top