VBA Sumif cell is a number

kitkatjam

New Member
Joined
Nov 30, 2018
Messages
11
I am trying to sum a range, say column A, but only if the corresponding row in column B is a number. Column B contains either numbers or "". I can't figure out how to say it.

Sumifs(Range(A:A), Range(B:B), IsNumeric) was my first attempt but didn't work. Any help would be greatly appreciated, thank you!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
63,289
Office Version
  1. 365
Platform
  1. Windows
Just use ">0" for your criteria.
By the way, since there is only one conditions, SUMIF will do. No reason to need SUMIFS, i.e.
Code:
=SUMIF(B:B,">0",A:A)
 
Last edited:

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,092
Office Version
  1. 365
Platform
  1. Windows
How about
=SUMIF(B2:B15,"<>*",A2:A15)
 

kitkatjam

New Member
Joined
Nov 30, 2018
Messages
11
The problem is the "" come back as >0. Even though it's not a number, it's returning >0 = True so it ends up summing everything
 

kitkatjam

New Member
Joined
Nov 30, 2018
Messages
11

ADVERTISEMENT

This worked, thank you!!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,092
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
63,289
Office Version
  1. 365
Platform
  1. Windows
The problem is the "" come back as >0. Even though it's not a number, it's returning >0 = True so it ends up summing everything
Hmmm...
It doesn't do that for me.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,092
Office Version
  1. 365
Platform
  1. Windows
Using >0 works for me as well, as long as none of the values in col B are negative.
In fact >0 still works for me if the formula returns " " rather than "" in col B
 
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,163,714
Messages
5,833,276
Members
430,201
Latest member
Deepakpilla36

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