PC Review


Reply
Thread Tools Rate Thread

Array Formula - Average from every other cell

 
 
Oscar Munero
Guest
Posts: n/a
 
      17th Jun 2008
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}
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      17th Jun 2008
=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 With Quote
 
Oscar Munero
Guest
Posts: n/a
 
      17th Jun 2008
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

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      17th Jun 2008
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

 
Reply With Quote
 
David Biddulph
Guest
Posts: n/a
 
      17th Jun 2008
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" <(E-Mail Removed)> wrote in message
news:C649EB5B-5759-4CBA-A30F-(E-Mail Removed)...
> =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 With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      17th Jun 2008
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" <(E-Mail Removed)> wrote in message
> news:C649EB5B-5759-4CBA-A30F-(E-Mail Removed)...
> > =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 With Quote
 
David Biddulph
Guest
Posts: n/a
 
      17th Jun 2008
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" <(E-Mail Removed)> wrote in message
news:B3EDC164-AE60-407F-A2FA-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in
>> message
>> news:C649EB5B-5759-4CBA-A30F-(E-Mail Removed)...
>> > =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 With Quote
 
Oscar Munero
Guest
Posts: n/a
 
      18th Jun 2008
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" <(E-Mail Removed)> wrote in message
> news:B3EDC164-AE60-407F-A2FA-(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in
> >> message
> >> news:C649EB5B-5759-4CBA-A30F-(E-Mail Removed)...
> >> > =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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Average If Array Formula =?Utf-8?B?TWV0ZW9yMTI0MA==?= Microsoft Excel Worksheet Functions 4 21st Sep 2007 09:57 PM
Average Array help with a formula chedd via OfficeKB.com Microsoft Excel Worksheet Functions 2 30th Jan 2006 11:30 PM
Help with an Average formula in array chedd via OfficeKB.com Microsoft Excel Crashes 0 30th Jan 2006 03:57 PM
Tricky array formula issue - Using array formula on one cell, then autofilling down a range aspenbordr Microsoft Excel Programming 0 27th Jul 2005 03:59 PM
Average Array Formula =?Utf-8?B?UmFjaGFlbA==?= Microsoft Excel Worksheet Functions 3 7th Jun 2005 04:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 PM.