- BY Kevin Lehrbass
- POSTED IN Formulas
- WITH 1 COMMENTS
- PERMALINK
- STANDARD POST TYPE

I need to calculate hours given data like this in each cell: “**9-10, 10-11, 10-11, 12-13, 12-15+, 14-17+**“

Download my Excel file with solution.

**Messy Data**

Data exported to Excel looks like this:

**Task**

I need to calculate total hours in each cell. Cell A2 = 4 hours, cell A3 = 6 hours, etc.

There were 10 columns and 20000 rows (my sample is smaller). Solution needs to be easy to audit.

**Solution**

Initially it seemed daunting. I could use text-to-columns to split out each start/stop value and then a ton of formulas. Urgency of the request forced me to consider alternative methods. Two questions:

Is “+” symbol only used after 3 hour intervals? Are all other time intervals only 1 hour?

The answer was “yes” to both questions. I saw the pattern and solved it like this:

- Count the “+” symbols in each cell.
- Count the commas.
- Total of 1 hour time intervals
- Total of 3 hour time intervals
- Final total.

**Review**

Sometimes an extra question saves a lot of unnecessary complexity and time!

Yes my solution is boring. No fancy dynamic arrays, vba, or power query. But if there’s a simple way to solve it shouldn’t we consider it? Especially when creating a solution that other people will use.

If the details were more complex (eg “+” didn’t exist, time increment could be any number) then I’d need a brute force method to subtract start time from end time. **A ton of helper columns? Power Query? Mega formula?**

**About Me**

My name is Kevin Lehrbass. I’m a Data Analyst and Excel enthusiast.

## 1 Comments