worksheet function – Excel If-Else formula to capture ”hour” and “min” across an excel row

I have a row of “h min” values (eg:2h 15min) across a row. I need to capture the ‘hour’ and ‘min’ separately for which I’m using “=LEFT(B2,(FIND(” “,B2,1)-1))” and “=MID(B2,FIND(” “,B2)+1,256)” in separate cells, using the space separator to identify them seperately.

The problem is when there is only either one value, i.e. only hour or only minute (eg. “2h” or “20min”) in which case I get an error. How should I re-code both my LEFT and MID formula to ensure it still captures the hour/minute where it’s present and gives a blank where it’s not present.

Many thanks.