Charge-displacement analysis for excited states