Excel: making a picky yet automatic formula

OK, here’s what I’m trying to do.

I need to get the average and standard deviation on ranges of spreadsheet cells.
I can’t just say “=AVERAGE(2:2)”, because I need to skip every second column.
By hand, it’s “=AVERAGE(B2, D2, F2, H2, J2, L2, N2…)”
The spreadsheet is going to get quite large, so doing this by hand will get to be a pain.
Is there a way to say effectively, “Give me the average on all even-numbered columns in this row”?

You could hold down the CTRL key and highlight all of the columns. Or, more simply, average just the one column, and drag your formula across each column, then average the averages with just one formula. Probably not the answer you’re seeking.

May I ask whether the columns which you’re skipping are populated with data, or are they empty columns inserted as padding/formatting? (If the latter, there’s probably an easy solution).

Nope, they have data too.
What it is: a spreadsheet comparing weather forecast high temperatures with actual high temperatures. The spreadsheet is much more readable if the forecast temperatures can appear next to the error.

This should do it:

=AVERAGE(IF(MOD(COLUMN($A$1:$I$1),3)<>0,$A$1:$I$1))

This formula will skip every 3rd column on the 1st row (using the Mod 3 <> 0). Adjust the Columns statement to reflect your columns and row.

Remember to press Ctrl+Shift+Enter after you enter is in the cell since it is an array formula.

You could also do this in VBA pretty easily which would provide for a little more sanity (I hate Excels formulas).

After rereading the OP to skip every other column use:

=AVERAGE(IF(MOD(COLUMN($A$1:$I$1),2)<>0,$A$1:$I$1))

(I think that’s what you want) :slight_smile:

All right, all right, If I would actually read the OP, I could be dangerous.

So, to skip every other column starting at the SECOND one use…

=AVERAGE(IF(MOD(COLUMN($A$2:$N$2),2)=0,$A$2:$N$2))

I need a beer.