![]() |
using a variable for MOD Statement
I make a report that has a varying number of rows and I use the variable
"MaxNumRows". The totals line for the report = MaxNumRows +3. Works great so far! I am using the cod =SUM(IF(MOD(ROW(R3C12:R(MaxNumRows)C12)-ROW(R3C12)+1,3)=0,R3C12:R(MaxNumRows)C12,0)) Doesn't work! I use MaxNumRows in other formulas; but it isn't working in THIS one. How can I make this formula become ...ROW(R3C12:R20C12) if the MaxNumRows = 20?? |
using a variable for MOD Statement
Are you trying to perform this calculation in VBA, or are you trying to
assign this formula to a cell? If you're trying to assign this formula to a cell, you probably want to do something like: Range("A1").FormulaR1C1 = "=SUM(IF(MOD(ROW(R3C12:R" & MaxNumRows & "C12)-ROW(R3C12)+1,3)=0,R3C12:R" & MaxNumRows & "C12,0))" Scott bethg7 wrote: I make a report that has a varying number of rows and I use the variable "MaxNumRows". The totals line for the report = MaxNumRows +3. Works great so far! I am using the code =SUM(IF(MOD(ROW(R3C12:R(MaxNumRows)C12)-ROW(R3C12)+1,3)=0,R3C12:R(MaxNumRows)C12,0)) Doesn't work! I use MaxNumRows in other formulas; but it isn't working in THIS one. How can I make this formula become ...ROW(R3C12:R20C12) if the MaxNumRows = 20?? |
using a variable for MOD Statement
YES!!! Thank you so much! You just saved me HOURS of work! BTW, it worked
like a charm! Thanks again. "Scott" wrote: Are you trying to perform this calculation in VBA, or are you trying to assign this formula to a cell? If you're trying to assign this formula to a cell, you probably want to do something like: Range("A1").FormulaR1C1 = "=SUM(IF(MOD(ROW(R3C12:R" & MaxNumRows & "C12)-ROW(R3C12)+1,3)=0,R3C12:R" & MaxNumRows & "C12,0))" Scott bethg7 wrote: I make a report that has a varying number of rows and I use the variable "MaxNumRows". The totals line for the report = MaxNumRows +3. Works great so far! I am using the code =SUM(IF(MOD(ROW(R3C12:R(MaxNumRows)C12)-ROW(R3C12)+1,3)=0,R3C12:R(MaxNumRows)C12,0)) Doesn't work! I use MaxNumRows in other formulas; but it isn't working in THIS one. How can I make this formula become ...ROW(R3C12:R20C12) if the MaxNumRows = 20?? |
All times are GMT +1. The time now is 01:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com