You would use it in a case where you are doing something that began in the past, continues in the present, and may continue into the future.
"I have been going to the university for two years."
"I have been cooking all afternoon."
"They have been working on that car all morning."
You also use it if you were something at some unspecified time in the recent past, or (possibly) continuing to the present for a specified time.
"I have been a teacher before."
"I have been a student for two years."
It is also used for some future duration.
"When I graduate, I will have been a student for four years."