aaaa,,,,yes yes yes...
Exactly. Nande is also used like that.
But the meaning comes from "why".
The feeling of surprise is often caused from the unanticipated situation.
And then people want to ask somebody "Why that happened!?"
So with "nande", they say "Somebody, tell me why!!"
In other case, maybe you know, there is a dialect word "nan de ya nen(why's that?)".
And when it is compressed, nande is used to complain to somebody or something.
Both nande are said when we have to make some reactions.
To distinguish them, their intonations are the point.
The lesson of nande is up here.^^