The calculation of retained earnings is very simple, just to substitute the values in one of the following formulas and to know the amount of net profit/loss of the company.
In order to calculate retained earnings will require knowledge of the following indices: retained earnings at beginning of the period net profit (Net Income or Net Profit) or net loss (Net Loss) and cash dividends paid.
After collecting all data for calculations, substitute the values in the following formula:
RE1 = RE0 + Net Income – Dividends,

where RE1/RE0 - retained earnings at the end/beginning of that period;

Net Income – net profit;

Dividends – dividends paid to shareholders.
In the event that the company in the current period received no net income, but rather net loss, the calculation is carried out according to the following formula:
RE1 = RE0 - Net Loss – Dividends,

where, as has become clear Net Loss - net loss.