This can be done in three ways: This spreadsheet will perform a Pearson's chi-square test. Make sure you have no zero expected frequencies! If you have a total sample size which is less than 20 you can use this spreadsheet to obtain an exact p-value (using Monte-Carlo simulations).
A chi-square calculator may also be found here. Note : There have been instances where this software incorrectly claims the total of the observed and expected frequencies are not equal when, in fact, they are.
Alternatively this may be performed in SPSS. The observed frequencies need to be entered in the spreadsheet using two columns: the first column specifying the category and the second the observed frequency. Input the observed frequency into the weight cases box using Data:weight cases . We are now ready to use the chi-square procedure located under nonparametric tests>chi-square. The columns containing the observed categories is entered in the test variables window. The expected frequencies may be entered in the menu window by clicking values under expected frequencies and entering the list of expected frequencies in the window. Note : SPSS cannot handle zero observed frequencies for a category even when the analogous expected frequency is non-zero.
For the chi-square analysis to be valid it is suggested you need a total sample size of at least 20.