Originally posted by: Hector13
Originally posted by: CrimsonChaos
The best solution for this is to use an array-type function. This allows you to total your categories without having to add an extra column.
Skip at least one cell after the column you are adding up, and type in the function below. Once you are done typing it, be sure to hit CTRL-SHIFT-ENTER so Excel views it as an array-type function.
=SUM(IF(A1:A30="NR",IF(A2:A31="NR",1,0)))+SUM(IF(A1:A30="R",IF(A2:A31="R",1,0)))+SUM(IF(A1:A30="W",IF(A2:A31="W",1,0)))
Obviously this assumes that your data is in column A1:A30. This formula would therefore be entered in cell A32 -- NOT A31. Change these numbers as you need to. Just increase the 2nd data-set by 1 (i.e. A2:A31).
Are you sure about your formula? Too lazy to check, but it seems like that would just be counting consecutive entries that are the same (not the number of transitions).
Also, since it is an array formula, you don't need the IF statements. You could just make it somthing like =SUM((A1:A30="R")*(A2:A31="NR"))
Best thing to do would be to setup a transition matrix (just a small 3x3 table with the column and row headings of N, R, and NR -- or whatever states you have). Then, in each cell, use the formula =SUM((A1:A30=ROW_HEADING)*(A2:A31=COLUMN_HEADING)). This will give you the full transition matrix for your data.
As mentioned above, hit CNTRL-SHIFT-Enter for these formulas.