FLEX is a reduced thrust setting for takeoff that decreases wear on the engines and prolongs engine life. It is achieved by telling the FMGC to behave as though the outside air temperature is higher than it really is.
Sometimes it is not a good idea to do this, for example if the OAT is really high, you have a short runway, very high elevation, or high weight. All of these things suggest that you should use full power (TOGA).
FLEX is calculated by adjusting ISA (15°C) for elevation (you subtract 1.98°C for every 1000ft) and then adding the result to the actual OAT.
So for example :
ISA − ((elev ÷ 1000) × (1.98 × −1)) 15° − ((0.84) × (1.98 × −1)) 15° − −1.66 = 16.66 OAT is 27°C FLEX = 27 + 16.66 ≡ 43.66°C
Flex value is entered as an integer, so in this case round the 43.66 down to 43 and that is what you would enter on the keypad before pressing LSK4-R.
Credit goes to http://mcdu.equicom.net/ for this information.