I decided to re-write my question to simplify what I'm after. I came across my first post on Stack about the same problem I'm having now. That's when I added all the INDIRECT
's to the code in this original question.
Sum with substitute, ignore and a dynamic range
I never was able to make the "*" wildcard mentioned in the linked post work. Maybe having non-English Excel come into play here?
In it's simplest form, could you help me rewrite this code (not working):
Range("namedRange").FormulaR1C1 = "=SUMPRODUCT(SUBSTITUTE(R10C:R[-1]C,""S"",""""))"
To do the following:
- Replace all "S'es" with
blank
("4S" would read "4" while summing) - Ignore all blank cells and cells containing other text than "S". "4T" should be ignored.
- Sum the numbers in range
- (Cell value will never be "4SK", so ok to fail on that)
I might be OK to write a function to do all of the above instead. But right now I'm stuck and my Google results leave me non the wiser. Any help would still be really appreciated