Sort only if id is excluded