PC Review


Reply
Thread Tools Rate Thread

AVG or Return 1 value from either of 2 cells if one is blank

 
 
Diddy
Guest
Posts: n/a
 
      18th Feb 2009
Hi everyone,

I'm using the following formula to average the values of 2 cells. If either
is empty, I want it to return the value in the non-blank cell.

=IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))

This works fine but is there a better way to do it?

Cheers
--
Diddy
 
Reply With Quote
 
 
 
 
Pete_UK
Guest
Posts: n/a
 
      18th Feb 2009
Here's another way (avoiding the IF):

=SUM(E8,H8)/COUNT(E8,H8)

Hope this helps.

Pete

On Feb 18, 11:00*am, Diddy <Di...@discussions.microsoft.com> wrote:
> Hi everyone,
>
> I'm using the following formula to average the values of 2 cells. If either
> is empty, I want it to return the value in the non-blank cell.
>
> =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
>
> This works fine but is there a better way to do it?
>
> Cheers
> --
> Diddy


 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      18th Feb 2009
Hi,

Average ignores blanks cell so

=AVERAGE(E8,H8)

does what you want.

Mike

"Diddy" wrote:

> Hi everyone,
>
> I'm using the following formula to average the values of 2 cells. If either
> is empty, I want it to return the value in the non-blank cell.
>
> =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
>
> This works fine but is there a better way to do it?
>
> Cheers
> --
> Diddy

 
Reply With Quote
 
Diddy
Guest
Posts: n/a
 
      18th Feb 2009
Hi Mike,

Sorry Mike, I've misled you! The data is coming in from worksheets prepared
by different people from a database. I've no control over what is put in the
db fields, so in some cases the missing data may be left blank or may be a
zero.

The formula I have does work but I wondered if there was a more efficient way.

Cheers
--
Diddy


"Mike H" wrote:

> Hi,
>
> Average ignores blanks cell so
>
> =AVERAGE(E8,H8)
>
> does what you want.
>
> Mike
>
> "Diddy" wrote:
>
> > Hi everyone,
> >
> > I'm using the following formula to average the values of 2 cells. If either
> > is empty, I want it to return the value in the non-blank cell.
> >
> > =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
> >
> > This works fine but is there a better way to do it?
> >
> > Cheers
> > --
> > Diddy

 
Reply With Quote
 
Diddy
Guest
Posts: n/a
 
      18th Feb 2009
Hi Pete,

Sorry MY fault. I did not phrase the question or the subject line correctly.

E8 or H8 can be either a value >0, 0 or blank. If both are a value then I
need the avg. If either one is blank or 0 then I need the other value
returned.

Thanks to both you and Mike for replying and sorry again :-)
--
Diddy


"Pete_UK" wrote:

> Here's another way (avoiding the IF):
>
> =SUM(E8,H8)/COUNT(E8,H8)
>
> Hope this helps.
>
> Pete
>
> On Feb 18, 11:00 am, Diddy <Di...@discussions.microsoft.com> wrote:
> > Hi everyone,
> >
> > I'm using the following formula to average the values of 2 cells. If either
> > is empty, I want it to return the value in the non-blank cell.
> >
> > =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
> >
> > This works fine but is there a better way to do it?
> >
> > Cheers
> > --
> > Diddy

>
>

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      18th Feb 2009
Hi,

It's irrelevant where the data are coming from. If your formula works well
then put my formula alongside yours is a cell and try and make them give
different answers and you'll fail to do so because they will always return
the same one. Including #DIV/0 of both cells are empty.

You asked for a simpler way and as of yet the one I posted is the simplest
and meets all of the requirements


Best regards,

Mike

"Diddy" wrote:

> Hi Mike,
>
> Sorry Mike, I've misled you! The data is coming in from worksheets prepared
> by different people from a database. I've no control over what is put in the
> db fields, so in some cases the missing data may be left blank or may be a
> zero.
>
> The formula I have does work but I wondered if there was a more efficient way.
>
> Cheers
> --
> Diddy
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > Average ignores blanks cell so
> >
> > =AVERAGE(E8,H8)
> >
> > does what you want.
> >
> > Mike
> >
> > "Diddy" wrote:
> >
> > > Hi everyone,
> > >
> > > I'm using the following formula to average the values of 2 cells. If either
> > > is empty, I want it to return the value in the non-blank cell.
> > >
> > > =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
> > >
> > > This works fine but is there a better way to do it?
> > >
> > > Cheers
> > > --
> > > Diddy

 
Reply With Quote
 
Diddy
Guest
Posts: n/a
 
      18th Feb 2009
Hi Mike,

I seem to have lost the gift of communication today. Not meaning to be rude
at all and very grateful for reponses.

What I meant to convey (and not succeeding at all) is that in the original Q
and the subject line, I've asked for ways to deal with blanks but the value
can be >0 if there is a score for the test, or 0 or blank.

0 or blank is if the test was missed (what I was trying to say when waffling
about data being from DB, was that if we could control the input at the db
stage then that would be a good solution).

Sorry again :-)
--
Diddy


"Mike H" wrote:

> Hi,
>
> It's irrelevant where the data are coming from. If your formula works well
> then put my formula alongside yours is a cell and try and make them give
> different answers and you'll fail to do so because they will always return
> the same one. Including #DIV/0 of both cells are empty.
>
> You asked for a simpler way and as of yet the one I posted is the simplest
> and meets all of the requirements
>
>
> Best regards,
>
> Mike
>
> "Diddy" wrote:
>
> > Hi Mike,
> >
> > Sorry Mike, I've misled you! The data is coming in from worksheets prepared
> > by different people from a database. I've no control over what is put in the
> > db fields, so in some cases the missing data may be left blank or may be a
> > zero.
> >
> > The formula I have does work but I wondered if there was a more efficient way.
> >
> > Cheers
> > --
> > Diddy
> >
> >
> > "Mike H" wrote:
> >
> > > Hi,
> > >
> > > Average ignores blanks cell so
> > >
> > > =AVERAGE(E8,H8)
> > >
> > > does what you want.
> > >
> > > Mike
> > >
> > > "Diddy" wrote:
> > >
> > > > Hi everyone,
> > > >
> > > > I'm using the following formula to average the values of 2 cells. If either
> > > > is empty, I want it to return the value in the non-blank cell.
> > > >
> > > > =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
> > > >
> > > > This works fine but is there a better way to do it?
> > > >
> > > > Cheers
> > > > --
> > > > Diddy

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      18th Feb 2009
Hi,

Now that's a different question. Not necessarily better then your but
another way

=AVERAGE(IF(ISNUMBER(MATCH(COLUMN(E8:H8),{5,8},0))*(E8:H8>0),E8:H8))

This is an array formula which must be entered by pressing CTRL+Shift+Enter
'and not just Enter. If you do it correctly then Excel will put curly brackets
'around the formula {}. You can't type these yourself. If you edit the formula
'you must enter it again with CTRL+Shift+Enter.

Mike

"Diddy" wrote:

> Hi Mike,
>
> I seem to have lost the gift of communication today. Not meaning to be rude
> at all and very grateful for reponses.
>
> What I meant to convey (and not succeeding at all) is that in the original Q
> and the subject line, I've asked for ways to deal with blanks but the value
> can be >0 if there is a score for the test, or 0 or blank.
>
> 0 or blank is if the test was missed (what I was trying to say when waffling
> about data being from DB, was that if we could control the input at the db
> stage then that would be a good solution).
>
> Sorry again :-)
> --
> Diddy
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > It's irrelevant where the data are coming from. If your formula works well
> > then put my formula alongside yours is a cell and try and make them give
> > different answers and you'll fail to do so because they will always return
> > the same one. Including #DIV/0 of both cells are empty.
> >
> > You asked for a simpler way and as of yet the one I posted is the simplest
> > and meets all of the requirements
> >
> >
> > Best regards,
> >
> > Mike
> >
> > "Diddy" wrote:
> >
> > > Hi Mike,
> > >
> > > Sorry Mike, I've misled you! The data is coming in from worksheets prepared
> > > by different people from a database. I've no control over what is put in the
> > > db fields, so in some cases the missing data may be left blank or may be a
> > > zero.
> > >
> > > The formula I have does work but I wondered if there was a more efficient way.
> > >
> > > Cheers
> > > --
> > > Diddy
> > >
> > >
> > > "Mike H" wrote:
> > >
> > > > Hi,
> > > >
> > > > Average ignores blanks cell so
> > > >
> > > > =AVERAGE(E8,H8)
> > > >
> > > > does what you want.
> > > >
> > > > Mike
> > > >
> > > > "Diddy" wrote:
> > > >
> > > > > Hi everyone,
> > > > >
> > > > > I'm using the following formula to average the values of 2 cells. If either
> > > > > is empty, I want it to return the value in the non-blank cell.
> > > > >
> > > > > =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
> > > > >
> > > > > This works fine but is there a better way to do it?
> > > > >
> > > > > Cheers
> > > > > --
> > > > > Diddy

 
Reply With Quote
 
Diddy
Guest
Posts: n/a
 
      18th Feb 2009
Hi Mike,

Yes that does the trick!

I'll probably stick with the original but learning alternative ways helps
more than you will know :-)

Thank you
--
Diddy


"Mike H" wrote:

> Hi,
>
> Now that's a different question. Not necessarily better then your but
> another way
>
> =AVERAGE(IF(ISNUMBER(MATCH(COLUMN(E8:H8),{5,8},0))*(E8:H8>0),E8:H8))
>
> This is an array formula which must be entered by pressing CTRL+Shift+Enter
> 'and not just Enter. If you do it correctly then Excel will put curly brackets
> 'around the formula {}. You can't type these yourself. If you edit the formula
> 'you must enter it again with CTRL+Shift+Enter.
>
> Mike
>
> "Diddy" wrote:
>
> > Hi Mike,
> >
> > I seem to have lost the gift of communication today. Not meaning to be rude
> > at all and very grateful for reponses.
> >
> > What I meant to convey (and not succeeding at all) is that in the original Q
> > and the subject line, I've asked for ways to deal with blanks but the value
> > can be >0 if there is a score for the test, or 0 or blank.
> >
> > 0 or blank is if the test was missed (what I was trying to say when waffling
> > about data being from DB, was that if we could control the input at the db
> > stage then that would be a good solution).
> >
> > Sorry again :-)
> > --
> > Diddy
> >
> >
> > "Mike H" wrote:
> >
> > > Hi,
> > >
> > > It's irrelevant where the data are coming from. If your formula works well
> > > then put my formula alongside yours is a cell and try and make them give
> > > different answers and you'll fail to do so because they will always return
> > > the same one. Including #DIV/0 of both cells are empty.
> > >
> > > You asked for a simpler way and as of yet the one I posted is the simplest
> > > and meets all of the requirements
> > >
> > >
> > > Best regards,
> > >
> > > Mike
> > >
> > > "Diddy" wrote:
> > >
> > > > Hi Mike,
> > > >
> > > > Sorry Mike, I've misled you! The data is coming in from worksheets prepared
> > > > by different people from a database. I've no control over what is put in the
> > > > db fields, so in some cases the missing data may be left blank or may be a
> > > > zero.
> > > >
> > > > The formula I have does work but I wondered if there was a more efficient way.
> > > >
> > > > Cheers
> > > > --
> > > > Diddy
> > > >
> > > >
> > > > "Mike H" wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Average ignores blanks cell so
> > > > >
> > > > > =AVERAGE(E8,H8)
> > > > >
> > > > > does what you want.
> > > > >
> > > > > Mike
> > > > >
> > > > > "Diddy" wrote:
> > > > >
> > > > > > Hi everyone,
> > > > > >
> > > > > > I'm using the following formula to average the values of 2 cells. If either
> > > > > > is empty, I want it to return the value in the non-blank cell.
> > > > > >
> > > > > > =IF(AND(E8>0,H8>0),AVERAGE(E8,H8),SUM(E8,H8))
> > > > > >
> > > > > > This works fine but is there a better way to do it?
> > > > > >
> > > > > > Cheers
> > > > > > --
> > > > > > Diddy

 
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
Excel 2002: Return blank when VLOOKUP on blank cells Mr. Low Microsoft Excel Misc 2 4th Jun 2009 05:12 PM
Return non-blank cells Gene Microsoft Excel Misc 0 27th May 2009 01:04 PM
Nested IF - return a blank when compared cells are blank Struggling in Sheffield Microsoft Excel New Users 1 9th Feb 2009 06:25 PM
Return All Non-Blank Cells =?Utf-8?B?c2hvcnRpY2FrZQ==?= Microsoft Excel Worksheet Functions 6 1st Oct 2007 09:29 PM
Index/match - make blank cells return a blank value. =?Utf-8?B?ZGlhYXJl?= Microsoft Excel Worksheet Functions 2 16th May 2007 05:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:36 AM.