excel - Average of TextBoxes that are not blank -
i need average of 5 textboxes there chance of them may empty. if so, should consider filled textboxes. have code find sum of couldn't succeed in finding average:
tot = tot + cdbl(textbox117.text) tot = tot + cdbl(textbox118.text) tot = tot + cdbl(textbox119.text) tot = tot + cdbl(textbox120.text) tot = tot + cdbl(textbox121.text) textbox70.text = tot
i tried counting number of boxes still couldn't result.
dim arr, long, n long, t double, v arr = array(textbox117, textbox118, textbox119, textbox120, textbox121) n = 0 t = 0 = lbound(arr) ubound(arr) v = trim(arr(i).text) if len(v) > 0 t = t + cdbl(v) n = n + 1 end if next textbox70.text = t textbox71.text = t/n
Comments
Post a Comment