ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Averaging adjacent Columns (https://www.excelbanter.com/excel-programming/308847-averaging-adjacent-columns.html)

Srikanth Ganesan[_2_]

Averaging adjacent Columns
 

Hi I have data in the following column format:

X Y X1 Y1 X3 Y3 ............ Average
1 3 5 2
34 2 0 4
. . .
. . .


There are many columns (X,Y,X1,Y1 ....) with numerical data in them. I
want to create two new column by name "Average X" & "Average Y". Column
"Average X" is the average of the X, X1 X2 X3.. columns. Column
"Average Y" is the average of the Y, Y1 Y2 Y3.. columns etc. How do I
write a macro to do this automatically. Please help.

Srikanth



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jim Thomlinson[_3_]

Averaging adjacent Columns
 
You don't need VBA. You can use an array formula similar to:

=AVERAGE(IF(LEFT(A$1:Z$1, 1)="X", B2:I2))

"Srikanth Ganesan" wrote:


Hi I have data in the following column format:

X Y X1 Y1 X3 Y3 ............ Average
1 3 5 2
34 2 0 4
. . .
. . .


There are many columns (X,Y,X1,Y1 ....) with numerical data in them. I
want to create two new column by name "Average X" & "Average Y". Column
"Average X" is the average of the X, X1 X2 X3.. columns. Column
"Average Y" is the average of the Y, Y1 Y2 Y3.. columns etc. How do I
write a macro to do this automatically. Please help.

Srikanth



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jim Thomlinson[_3_]

Averaging adjacent Columns
 
Sorry...=AVERAGE(IF(LEFT(A$1:Z$1, 1)="X", A2:Z2))


"Jim Thomlinson" wrote:

You don't need VBA. You can use an array formula similar to:

=AVERAGE(IF(LEFT(A$1:Z$1, 1)="X", B2:I2))

"Srikanth Ganesan" wrote:


Hi I have data in the following column format:

X Y X1 Y1 X3 Y3 ............ Average
1 3 5 2
34 2 0 4
. . .
. . .


There are many columns (X,Y,X1,Y1 ....) with numerical data in them. I
want to create two new column by name "Average X" & "Average Y". Column
"Average X" is the average of the X, X1 X2 X3.. columns. Column
"Average Y" is the average of the Y, Y1 Y2 Y3.. columns etc. How do I
write a macro to do this automatically. Please help.

Srikanth



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Srikanth Ganesan[_2_]

Averaging adjacent Columns
 

Jim,

It does not seem to work. Please help. Thanks

Srikanth


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 10:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com