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"))
 

Some videos you may like

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

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!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,335
Messages
5,595,576
Members
413,996
Latest member
mabelO

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