The attrition rate is calculated by dividing the number of employees who left by the average number of employees during a specified period, then multiplying by 100 to get a percentage.