Corrected ranks formatting to ignore empty rows.