XL.Sheet.AutoFilter.SortLevels
------------------------------

Gets the number of sort levels.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XL](component_XL.md) | [16.3](newinversion163.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XL.Sheet.AutoFilter.SortLevels"; BookRef; SheetIndex ) 

**MBS**( **"XL.Sheet.AutoFilter.SortLevels";** /\* Gets the number of sort levels. \*/  
**$BookRef**; /\* The reference number for the workbook.e.g. $ref \*/   
**$SheetIndex**) /\* The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| BookRef | The reference number for the workbook. | $ref |
| SheetIndex | The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1. | 0 |

### Result

Returns OK or error.

### Description

Gets the number of sort levels.  
### See also

- [XL.Book.SheetCount](XLBookSheetCount.md)
- [XL.Sheet.AutoFilter.SetRef](XLSheetAutoFilterSetRef.md)
- [XL.Sheet.AutoFilter.SetSort](XLSheetAutoFilterSetSort.md)
- [XL.Sheet.AutoFilter.SetTop10](XLSheetAutoFilterSetTop10.md)

### Release notes

- **Version 16.3**
    - Added XL.Sheet.AutoFilter.GetSortEx and XL.Sheet.AutoFilter.SortLevels functions.

Created 21st May 2026 , last changed 22nd May 2026

  
[XL.Sheet.AutoFilter.SetTop10](XLSheetAutoFilterSetTop10.md) - [XL.Sheet.CellIsDate](XLSheetCellIsDate.md)

[HTML Version](XLSheetAutoFilterSortLevels.shtml)