Ernie Macmillan works his way up through the Ministry, to eventually become the Head of Accounting and Payroll for Ministry of Magic Employees.
His meticulous nature is well-suited to the work, and his years of experience with pompous leadership is well suited to being the Department Head. He excels in the position, and keeps the affairs of a shifting system afloat admirably.
The leaders of Wizarding Britain’s new democratic system, who now require that new Department Heads do not keep their positions for periods extending six years, grant Ernie an exception to the rule after his term as Head…mostly because no one else wants the job. He stays the longest running Department Head in Ministry of Magic history.