Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Array Formula - Average from every other cell

Hi,

I have data in A2:A325, A2,A4,A6 etc represents length and A3,A5,A7 etc
represents breadth.

I am trying to calculate average length and average breadth, so I want to
just average A2,A4,A6 etc and seperately want to average A3,A5,A7 etc.

I've tried using the array formulas below but with little success, can
anyone point out where I'm going wrong or offer an alternative?

=AVERAGE(IF(MOD(A2:A324,2),"",A2:A324)) gives #DIV/0!
=AVERAGE(IF(MOD(A3:A325,2),A3:A325,"")) gives an answer I'm not sure is
correct

Thanks,
Oscar.

PS. I have used [Ctrl][Shift][Enter] to get {around array}
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Array Formula - Average from every other cell

=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,0))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,0))
both array entered
--
Gary''s Student - gsnu200792
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Array Formula - Average from every other cell

Absolutely terrific, that's nailed it!

Thanks a million Gary's Student,

Oscar

"Gary''s Student" wrote:

=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,0))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,0))
both array entered
--
Gary''s Student - gsnu200792

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Array Formula - Average from every other cell

You are very welcome!
--
Gary''s Student - gsnu200792


"Oscar Munero" wrote:

Absolutely terrific, that's nailed it!

Thanks a million Gary's Student,

Oscar

"Gary''s Student" wrote:

=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,0))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,0))
both array entered
--
Gary''s Student - gsnu200792

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Array Formula - Average from every other cell

Doesn't that throw in a lot of zeroes to the average, both for the alternate
rows and for any blank input cells? It doesn't seem to give the right
answer for me.

What does seem to give the right answer (on limited testing) is
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,IF(A1:A325="","" ,A1:A325),""))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,IF(A1:A325="","" ,A1:A325),""))
both array entered.
--
David Biddulph

"Gary''s Student" wrote in message
...
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,0))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,0))
both array entered
--
Gary''s Student - gsnu200792





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Array Formula - Average from every other cell

You are correct!!
I forgot that AVERAGE ignores blanks, not zeros. My formulas should have
been:

=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,""))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,""))

Thanks for the correction!
--
Gary''s Student - gsnu200792


"David Biddulph" wrote:

Doesn't that throw in a lot of zeroes to the average, both for the alternate
rows and for any blank input cells? It doesn't seem to give the right
answer for me.

What does seem to give the right answer (on limited testing) is
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,IF(A1:A325="","" ,A1:A325),""))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,IF(A1:A325="","" ,A1:A325),""))
both array entered.
--
David Biddulph

"Gary''s Student" wrote in message
...
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,0))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,0))
both array entered
--
Gary''s Student - gsnu200792




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Array Formula - Average from every other cell

Doesn't your formula still have problems where there are blank cells in the
input range? Doesn't your formula effectively turn those into zeroes?
That's why I had my additional test for blank inputs.
--
David Biddulph

"Gary''s Student" wrote in message
...
You are correct!!
I forgot that AVERAGE ignores blanks, not zeros. My formulas should have
been:

=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,""))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,""))

Thanks for the correction!
--
Gary''s Student - gsnu200792


"David Biddulph" wrote:

Doesn't that throw in a lot of zeroes to the average, both for the
alternate
rows and for any blank input cells? It doesn't seem to give the right
answer for me.

What does seem to give the right answer (on limited testing) is
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,IF(A1:A325="","" ,A1:A325),""))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,IF(A1:A325="","" ,A1:A325),""))
both array entered.
--
David Biddulph

"Gary''s Student" wrote in
message
...
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,0))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,0))
both array entered
--
Gary''s Student - gsnu200792






  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Array Formula - Average from every other cell

Hi Guys,

I tried both your suggestions (Gary''s Students' amended version) and I'm
getting the same answer for average from each method.

I can see where David Biddulph is coming from though, if I extend the range
to include e.g. A1:A330 (5 blank cells) then the 2 suggested arrays begin to
return different average answers.

Luckily my original data set has neither blanks nor zeroes, so both methods
work just fine.

Thanks to you both for increasing my understanding of how arrays work,

Oscar.


"David Biddulph" wrote:

Doesn't your formula still have problems where there are blank cells in the
input range? Doesn't your formula effectively turn those into zeroes?
That's why I had my additional test for blank inputs.
--
David Biddulph

"Gary''s Student" wrote in message
...
You are correct!!
I forgot that AVERAGE ignores blanks, not zeros. My formulas should have
been:

=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,""))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,""))

Thanks for the correction!
--
Gary''s Student - gsnu200792


"David Biddulph" wrote:

Doesn't that throw in a lot of zeroes to the average, both for the
alternate
rows and for any blank input cells? It doesn't seem to give the right
answer for me.

What does seem to give the right answer (on limited testing) is
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,IF(A1:A325="","" ,A1:A325),""))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,IF(A1:A325="","" ,A1:A325),""))
both array entered.
--
David Biddulph

"Gary''s Student" wrote in
message
...
=AVERAGE(IF(MOD(ROW(A1:A325),2)=0,A1:A325,0))
=AVERAGE(IF(MOD(ROW(A1:A325),2)=1,A1:A325,0))
both array entered
--
Gary''s Student - gsnu200792






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Average If Array Formula Meteor1240 Excel Worksheet Functions 4 September 21st 07 09:57 PM
Array Formula to find Average Return Paul987 Excel Discussion (Misc queries) 1 May 9th 06 06:20 PM
Average Array help with a formula chedd via OfficeKB.com Excel Worksheet Functions 2 January 30th 06 11:30 PM
Array Formula to Pick Average SludgeQuake Excel Discussion (Misc queries) 3 January 11th 06 12:59 AM
Average Array Formula Rachael Excel Worksheet Functions 3 June 7th 05 04:00 PM


All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"