actual_range: observed data
theoretical_range: expected values
If the actual range is not an n by 1 or 1 by n range, but an n by m range, then CHITEST uses (n-1) times (m-1) as degrees of freedom. This is useful if the expected values were calculated from the observed value in a test of independence or test of homogeneity.
This function is Excel compatible.
CHITEST is the OpenFormula function LEGACY.CHITEST.