The Freedericksz transition in twist cells of cholesteric liquid crystals with a finite surface energy is considered. It is shown that this transition can be either of the second order or of the first order depending on the values of the Frank constants, pitch, surface energies, and the cell thickness. A simple criterion that determines the order of the phase transition is obtained. By numerically minimizing the free energy of the liquid-crystal pattern the distribution of the director in the presence of the external
electric field is calculated. For this purpose the polar angle of the director was presented as a
partial sum of the Fourier series and of the appropriate function. The azimuthal angle was eliminated using Euler-Lagrange equations. Calculations were performed for different sets of liquid-crystal parameters which provide the phase transition of the first and of the second order. The numerical results are in a good agreement with theoretical formulas based on the Landau-type theory.