excel - Removing text and autosumming in VBA -


i attempting sum numbers in row adding formula in vba doesn't seem formula.

each cell looks [ vertical lines not included in cells ]:

30 (gold)  |  25 (silver)  |  20 (gold)  |  13 (green) 

so needs remove after "("

worksheets("season 2014-2015").cells(lastseasonrow, 14).formula = "=sum(left(b" & lastseasonrow & ":l" & lastseasonrow & ",instr(1, b" & lastseasonrow & ":l" & lastseasonrow & ","" (""))" 

try array formula involving sumproduct function using iferror function discard non-valid/blank entries,

with worksheets("season 2014-2015").cells(lastseasonrow, 14)     .formulaarray = "=sumproduct(iferror(value(left(trim(b" & lastseasonrow & ":l" & lastseasonrow & "), find(char(32), trim(b" & lastseasonrow & ":l" & lastseasonrow & "&char(32))))), 0))" end 

i used char(32) (char function) because avoid dealing quotes in quoted strings. trim function can left out if not have leading spaces in actual data.

    sumproduct iferror total text numbers


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -