Using A1:A31 as your "Month" then try;

Formula: copy to clipboard
=SUM(IF(ISNUMBER(FIND("H",$A$1:$A$31)),VALUE(LEFT($A$1:$A$31,FIND("H",$A$1:$A$31)-1)),0))


It's an Array formula so you'll need to press CTRL, Shift and Enter instead of just Enter when you've input it, if done correctly you should see curly braces { } at either side of the Formula.