ed is a more appropriate tool than sed for noninteractive editing when the file to be manipulated is free-form and/or you need to go backwards.
I wouldn't rule anything as beyond sed's capabilities, since thanks to its hold buffer, label and branching features, it's probably Turing-complete. But I think ed is a better (and more idiomatic) fit for the scenarios I mentioned.