What functionalities in a software are usually undoable (with undo) and which are not?

I have been wondering what functionalities are usually undoable and which not. For example, in Excel writing content into cells can be reverted, freezing panes or adding comments not. Is there a reasoning on what to include in undo?