简体   繁体   中英

Excel formula to Sum a row up to specific column number

I want to sum a row like

A          B         C         D         E   
2          4         3         5         5

I want the formula to sum from A1 to some column number like It can be up to column 4 (D1) or up to column 5 (E1). I can retrieve column number but how to add up to that column number is what I am asking for. Start of sum is fixed A1 but end is dynamic (not fixed)

Any solution will be highly appreciated

It's probably easiest to sum up the entire row =SUM(2:2) (to sum the values in row 2) or if you have some other data at the beginning (or you want the sum to show up at the beginning) you can do something like =SUM(B2:XFD2)

I got that last column name here: https://www.quora.com/What-is-the-last-column-name-in-an-Excel-file and checked it was the same as newer versions here: https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3#ID0EBABAAA=Newer_versions

Say we want to sum up part of the first row.

Place the first column number in A2 and the last column number in A3 . Then:

=SUM(INDEX(1:1,A2):INDEX(1:1,A3))

在此处输入图片说明

In your posted example, you would put 1 in A2 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM