Excel: How do I reference an entire row except for a couple of cells?

Something similar has been asked before and I'll repeat this answer: just put:

=sum(a3:a1048576)

because that's the max number of cells per column / row in Office 2007 and 2010. (65536 is max for before 2007.) (For columns, the max column name is XFD in 2007 and 2010, and IV before 2007.)


Add up everything and then take away the ones you don't want to include:

=SUM(A:A)-A1-A2

Edit:

As josmh has pointed out, the formula above will fail with an error if A1 or A2 are non numeric - but the following will work:

=SUM(A:A)-SUM(A1,A2)  

or

=SUM(A:A)-SUM(A1:A2)  

or (for a bit of fun!)

=SUM(A:A,(-1*(SUM(A1))),(-1*SUM((A2))))

These work because the SUM function ignores non-numeric fields


This already has several fine answers but here's a method I haven't yet seen posted:

=SUM(OFFSET(3:3,0,2,1,COLUMNS(3:3)-2))

The format is SUM(OFFSET(Range, Rows, Cols, [Height], [Width])). We start with the entire range, offset it zero rows down and two columns over, set the height to 1, and set the width to its current width minus two. So long as the width adjustment is the same as the offset, it works perfectly. Here's the same idea to sum a column instead of a row: (Notice that you don't have to use the Width parameter because you want the same width as the original range.)

=SUM(OFFSET(A:A,2,0,ROWS(A:A)-2))

The benefit of these formulas over the currently accepted answer is that they work in any version of excel. It also won't adjust the range if you insert cells in front because it's referencing the entire row / column. You may or may not want that functionality depending on your data setup.