Use Past Perfect Continuous (had been + -ing) for actions that were ONGOING for a period of time BEFORE another past action or time. It emphasizes DURATION of an action that happened before something else in the past.
Quick tip: HAD BEEN + -ING = action was ongoing for a period BEFORE another past action. Use with FOR/SINCE to show duration.
Form: HADBEEN + verb + -ING
Positive: I/you/he/she/it/we/they had been working. Negative: hadn't been working. Question: Had ... been working?
I had been studying for 3 hours when she called. (studying started before, continued until call)
They had been waiting for an hour when the bus arrived. (waiting before bus came)
She had been living there for 5 years before she moved. (living before moving)
How long had you been working there? (duration before past point)
Use: Duration before another past action
Use when you want to emphasize HOW LONG an action continued before another past event. The action was ongoing and then something happened.
I had been running for 30 minutes when it started raining. (running before rain)
He had been teaching for 10 years when he retired. (teaching before retirement)
We had been discussing it for hours before we decided. (discussing before decision)
Past Perfect vs Past Perfect Continuous
Past Perfect (had done) = completed action before past. Past Perfect Continuous (had been doing) = ongoing action before past.
I had finished my homework when she called. (completed - Past Perfect)
I had been doing my homework for 2 hours when she called. (ongoing - Past Perfect Continuous)
She had read 3 books. (completed)
She had been reading all day. (ongoing)
Common mistakes
Not "I was studying for 3 hours when she called." — say "I had been studying for 3 hours when she called.". Use Past Perfect Continuous (not Past Continuous) when the action started BEFORE another past action..
Not "I had studied for 3 hours when she called." — say "I had been studying for 3 hours when she called.". Use Continuous form to emphasize DURATION. Had studied = completed. Had been studying = ongoing duration..
Practise it
Ask: Was the action ONGOING before another past action? Did it continue for a period? Then use Past Perfect Continuous!