Select every other cell in a row for a formula

cdpar

New Member
Joined
Nov 16, 2018
Messages
7
Hi,

I have a row of numbers with more than 100 cells. I need to "Select" every other cell to use in a formula.

Example: SUM(A1+A3+A5+A7 ... GA1+GA3)

How can I automatically have Excel give me all of the cell addresses for every other cell in the row?

The number of cells in the row changes from week to week so I have to modify the resulting formula each week.

Thank you!
 
If you are simply trying to sum the row you can use this
=SUM(IF(ISODD(COLUMN($A1:$EZ1)),$A$1:$EZ$1))
Just change the values in red to a column that you don't think will ever be exceeded.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
paste the following codes to right click on the sheet name > view code > paste
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Integer, a As Integer, total As Integer
    If Target.Address = "$A$150" Then
    x = Cells(1, Columns.Count).End(xlToLeft).Column
    total = 0
            For a = 1 To x Step 2
            total = total + Cells(1, a)
            Next a
        Cells(150, 1) = total
    End If
MsgBox "The total of odd columns from " & x & " columns is " & Cells(150, 1)
End Sub
when you click on cell 150 it recalculates and sum of odd columns is displayed with a message. I did experience some problems I will try to solve it.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top