If Statements in pivot tables

Hello, I am new to the world of Pivot Tables but am becoming a believer! I am attempting to create a formula via an IF statement but am having a bit of trouble arranging it. What I want to do is the following:

If the value in column ‘AA’ is less than 4100 then return a value of ‘S’, If the value in column ‘AA’ is greater than 4100 but less than 8100 then return a value of ‘M’, If the value in column ‘AA’ is greater than 8100 then return a value of ‘L’.

I want the entire verbiage to be a single formula. Any ideas?

Do you need this in Pivot or in common datatable ?
In case of Pivot all math goes against the group of records, so you have multiple records and based on their values formula provides an aggregated value.
Or do you need to apply the above formatting to the result table view ( after grouping and aggregation ) ?

Ahhh, good point. I do need it in the common data table directly vs. in Pivot.

In case of datatable you can place a formula in the template

http://webix.com/snippet/6099d7e5

Thanks maksim, I’ll give it a go!