Sum If Column

marvellousmaz

New Member
Joined
Mar 26, 2014
Messages
7
I write quite a bit of vba but I really cant get my head around this one!

I have entered this in Cell L204

=SUMIF(N204:Z204,">0")

Works a treat.

I would like a vba that enters this in All rows this a value in column N

Don't know why but I just cant seem to get my head around it today!

Any help would be appreciated.

Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Welcome to the Board!

I would like a <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: rgb(0, 0, 0); cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">vba</acronym> that enters this in All rows this a value in column N
I am not sure it is clear what you are after. Can you try explaining again in a little more detail?
 
Upvote 0
Welcome to the Board!


I am not sure it is clear what you are after. Can you try explaining again in a little more detail?


Sorry.

In a nut shell I would like to add up values in N:Z and put the total in L. But only if there is a value. I don't want it to read zero.

Thanks
 
Upvote 0
How about this?
Code:
=IF(COUNT(N204:Z204)>0,SUMIF(N204:Z204,">0"),"")
 
Upvote 0
How about this?
Code:
=IF(COUNT(N204:Z204)>0,SUMIF(N204:Z204,">0"),"")

Thanks for the reply.

Yeah thats similar to what I wrote with the =sumif.

Problem is it only works on one line. I want it to start checking at the top of N and keep going till the last cell this something in.

I have tried setting a range from top to last of column but thats when I start to have problems.

Thanks
 
Upvote 0
I am quite sure I am 100% clear on what you are asking, but are you asking how to anchor the start row (which would be absolute range references?

For example, if you placed this in row 2, and copied it down:
Code:
=IF(COUNT(N$2:Z2)>0,SUMIF(N$2:Z2,">0"),"")

Here is what it would look like in the next rows:

Row3:
Code:
=IF(COUNT(N$2:Z3)>0,SUMIF(N$2:Z3,">0"),"")
Row4:
Code:
=IF(COUNT(N$2:Z4)>0,SUMIF(N$2:Z4,">0"),"")
etc.

Is that what you are after?
If not, I think we will need you to explain more. Maybe work us through an actual example.
 
Upvote 0
I am quite sure I am 100% clear on what you are asking, but are you asking how to anchor the start row (which would be absolute range references?

For example, if you placed this in row 2, and copied it down:
Code:
=IF(COUNT(N$2:Z2)>0,SUMIF(N$2:Z2,">0"),"")

Here is what it would look like in the next rows:

Row3:
Code:
=IF(COUNT(N$2:Z3)>0,SUMIF(N$2:Z3,">0"),"")
Row4:
Code:
=IF(COUNT(N$2:Z4)>0,SUMIF(N$2:Z4,">0"),"")
etc.

Is that what you are after?
If not, I think we will need you to explain more. Maybe work us through an actual example.

No I want each one different, so

in L1 =SUMIF(N1:Z1,">0")
in L2 =SUMIF(N2:Z2,">0")
in L3 =SUMIF(N3:Z3,">0")
in L4 =SUMIF(N4:Z4,">0")
but only if there is something in N

Is that a better explanation?

 
Upvote 0
How about:
Code:
=if(len(n1)>0,sumif(n1:z1,">0"),"")[/COLOR]
 
Upvote 0
Just copy the formula down. The row references will automatically adjust to reflect the row they are in.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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