excel vba runtime error 7: out of memory formula length greater than 1024 -
i developed macro user select criteria , have create formulas on selected criteria. getting out of memory error 7 when formula length greater 1024 characters.
activesheet.cells(29, 4).formula = quar_dchc_high_8_9_10
the length of string quar_dchc_high_8_9_10
1290 characters. creating problem? formula in quar_dchc_high_8_9_10
=sumproduct(sign('[jan_hc.xls]hc'!$ax$2:$ax$65536="6g"),sign('[jan_hc.xls]hc'!$x$2:$x$65536="female"),sign('[jan_hc.xls]hc'!$ax$2:$ax$65536=8))+sumproduct(sign('[jan_hc.xls]hc'!$ax$2:$ax$65536="6g"),sign('[jan_hc.xls]hc'!$x$2:$x$65536="female"),sign('[jan_hc.xls]hc'!$ax$2:$ax$65536=9))+sumproduct(sign('[jan_hc.xls]hc'!$ax$2:$ax$65536="6g"),sign('[jan_hc.xls]hc'!$x$2:$x$65536="female"),sign('[jan_hc.xls]hc'!$ax$2:$ax$65536=10))+sumproduct(sign('[feb_hc.xls]hc'!$av$2:$av$65536="6g"),sign('[feb_hc.xls]hc'!$w$2:$w$65536="female"),sign('[feb_hc.xls]hc'!$av$2:$av$65536=8))+sumproduct(sign('[feb_hc.xls]hc'!$av$2:$av$65536="6g"),sign('[feb_hc.xls]hc'!$w$2:$w$65536="female"),sign('[feb_hc.xls]hc'!$av$2:$av$65536=9))+sumproduct(sign('[feb_hc.xls]hc'!$av$2:$av$65536="6g"),sign('[feb_hc.xls]hc'!$w$2:$w$65536="female"),sign('[feb_hc.xls]hc'!$av$2:$av$65536=10))+sumproduct(sign('[mar_hc.xls]hc'!$av$2:$av$65536="6g"),sign('[mar_hc.xls]hc'!$w$2:$w$65536="female"),sign('[mar_hc.xls]hc'!$av$2:$av$65536=8))+sumproduct(sign('[mar_hc.xls]hc'!$av$2:$av$65536="6g"),sign('[mar_hc.xls]hc'!$w$2:$w$65536="female"),sign('[mar_hc.xls]hc'!$av$2:$av$65536=9))+sumproduct(sign('[mar_hc.xls]hc'!$av$2:$av$65536="6g"),sign('[mar_hc.xls]hc'!$w$2:$w$65536="female"),sign('[mar_hc.xls]hc'!$av$2:$av$65536=10))
is formula length greater 1024 characters causing error how solve it?
so must shorten formula.
first, see sheet name '[jan_hc.xls]hc'
often. necessary include reference workbook , sheet in formula? if not, remove , done.
likewise can shorten characters range $ax$2:$ax$65536
making named range, e.g. name all
.
otherwise use more 1 cell formula , have parts in each cell, being finalized in target cell.
edit:
you can replace sumproduct
sum
because arrays 1 value, namely result of sign
1 or 0.
Comments
Post a Comment