Need some help adding up values in nth cells with text in the cells in between

newtoexcel86

New Member
Joined
May 22, 2009
Messages
48
i have a problem adding cells every 5th cell for example i have

=SUMPRODUCT((C10:C67)*(MOD(ROW(C10:C67),5)=0))

this adds every 5th row in this range and it does it right as long as there is no text in the cells in between

it works fine when it looks like this

1
1
1
1
1
1
1

but it does not work when it looks like this

1
1
text
1
1
1

when this happens it appears as #VALUE, meaning an error but i don't understand why if i'm just telling it to look at every 5th row and those specific rows have no text in them

i have a spreadsheet with text in between the cells that need to be added so i need a formula that only adds up the cells with numbers on it, to be specific the numbers are either ones or zeroes..... thank you for your help
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try...

=SUMPRODUCT(--(MOD(ROW(C10:C67)-ROW(C10),5)=0),C10:C67)
 
Upvote 0
thank you for that.. now if i wanted to do it so it reads all of column c starting at row 23 what would i have to do?
 
Upvote 0
Try...

=SUMPRODUCT(--(MOD(ROW(C23:C65536)-ROW(C23),5)=0),C23:C65536)

However, if the data does not actually extent to Row 65536, use a dynamic named range to refer to the data. A search on this Board for 'dynamic named ranges' should yield some examples. Actually, if you're using Excel 2003, you can convert the data in to a list (Data > List > Create List). The range will automatically adjust as data is added/removed.
 
Upvote 0
ok ill do that.. thank you for your help but i have one more question.. i have the same problem that i had before when i had text in between but now in some of the cells i have #value meaning an error in that cell.. but i'm not telling it to read that cell so it shouldn't.. last question i have
thank you in advance
 
Upvote 0
Presumably, the error is the result of a formula. If this is the case, how about modifying the formula so that it returns a formula blank/null text string ("") instead of #VALUE! ? This way, SUMPRODUCT will ignore the formula blanks. Otherwise...

=SUM(IF(ISNUMBER(C23:C65536),IF(MOD(ROW(C23:C65536)-ROW(C23),5)=0,C23:C65536)))

...which needs to be confirmed with CONTROL+SHIFT+ENTER.
 
Upvote 0
sorry to bother so much but i need a formula that would be like countif,
that would count every 12th cell in a column only if those cells contain a date. with text in the cells in between same as before but the countif formula that would only count the amount of cells with dates in them
 
Upvote 0
Try...

=SUMPRODUCT(--(MOD(ROW(C2:C100)-ROW(C2),12)=0),--ISNUMBER(C2:C100))

Adjust the ranges, accordingly.
 
Upvote 0
that worked like a wonder... i'm trying to learn so if you could tell me what about if i wanted to count cells in the same way but instead of counting the ones with dates, count the ones with a zero or positive numbers... no negative numbers...
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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