Possible? Yes, as you've shown.
Valid? Depends on what you mean. It's an estimate, and estimates can be biased.
Consider the case where half the respondents give you exact measurements (e.g. 22 hours) and then half give you a binned estimate (e.g. 21-30 hours). If you calculate the average binned estimate as you showed above
n1 x midpoint of category 1 + n2 x midpoint category 2 ..... divide by total n
then you could add that number with the mean exact measurement, divide by 2, and get an estimate of the average working hours.
Or maybe you want to give more weight to the mean exact measurement, and so you could do a weighted average of the two means to estimate the average working hours.
A third estimator could look like this: Bin the exact measurements into the three categories, and then find the deviation of the empirical average within a bin from the midpoint of that bin. (e.g. with exact hours observed as 22, 24, and 23, the average within the bin is 23, which deviates from 25.5 by 2.5). Then, you may choose to use the empirical average within the bin (instead of the midpoint of the bin) in order to calculate the average work hours from the observations that had measurement in categories/bins:
n1 x empirical average (from observations with exact measurements) within bin 1 + n2 x empirical average within bin 1 ..... divide by total n
Another estimator could take a parametric assumption and/or Bayesian framework to estimate the average from the obervations with binned measurements.
There are plenty of estimators. Theory of statistics can show that some may "work better" than others. If you're a frequentist you'll probably want one with 95% asymptotic coverage. Those estimators would probably be the "most valid".
As another answer points out, your proposed method is likely to be biased, and so maybe not as "valid" as you would like. Reporting the percent of observations in each bin, however, is a very good way of explaining your data. if you feel strongly above giving an estimate of the overall mean, you could do so, but be sure to be clear that you used a midpoint-calculation statistic like your proposed method, and perhaps state that your estimate is not very precise.