Hi Bob Spence,
Thank you for contacting us regarding your Excel spreadsheet. As per your description, you would like to calculate the total of "Our KMs" values in each row, where each job spans 10 columns, and "Our KMs" always falls in columns with numbers ending in 7 (e.g., columns 27, 37, 47, etc.).
To resolve this, please follow the steps below:
- Go to the row you want to calculate the total for (for example, row 4).
- In the cell where you want to display the total (e.g., the last column of that row), paste the following formula:
=SUM(FILTER(A4:ZZ4, MOD(COLUMN(A4:ZZ4),10)=7))
This formula works with Excel 365 or Excel 2021.
It sums only the values in columns where the column number ends in 7 — which correspond to the "Our KMs" values.
Replace A4:ZZ4 with the actual range for your data if needed (e.g., A5:ZZ5 for row 5).
- Copy the formula down to other rows if you need totals for multiple weeks.
- COLUMN(A4:ZZ4) returns the column numbers.
- MOD(...,10)=7 filters the columns ending in 7.
- FILTER(...) returns only the relevant cells from the row.
- SUM(...) calculates the total.
If you're using an older version of Excel that doesn’t support the FILTER function, feel free to reply and we’ll help you with an alternative using helper columns or VBA.
If the information provided doesn’t fully address your situation, please feel free to share more details so I can offer the most appropriate solution for your specific needs.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.