The Headoffice-branch relationship is defined by the head-office code being e.g. "HEAD.", and branches being "HEAD.BRANCH". Any Name code with an internal dot is taken to be a branch of some head office. MoneyWorks now warns you about using internal dots inappropriately, but some users manage to have spurious ones.
Having such broken not-really-branches can break the Aged Debtors report.
How to find these non-branches?
Here's a search:
PositionInText(code, ".") > 0 and Lookup(Left(Code, PositionInText(code, ".")), "Name.Code") = ""
This will find all Names with a code that appears to be a branch (has internal ".") but does not have a head office. Such codes should be changed to remove the "."
As of v7, the Aged Debtors/Creditors reports are smart enough to detect orphan "branches" and treat them as normal non-branches.