A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

COUNT IF but not if 'X' IS NULL



 
 
Thread Tools Display Modes
  #1  
Old August 1st, 2008, 12:33 PM posted to microsoft.public.excel.worksheet.functions
Pyrite
external usenet poster
 
Posts: 84
Default COUNT IF but not if 'X' IS NULL

Hi,

I have a list of vehicle types and a list of MPG figures. I want to do an
average MPG for each vehicle type so I need to know not only how many of the
vehicle type there are but also how many of that type of vehicle have an MPG
figure with them.

E.g. I have 132 Peugeot vehicles, if I total the MPG figures and divide by
132 that gives me the average but only if every one of the Peugeots has a
figure for that month which they dont. For this reason I need to know how
many of those 132 have a figure with them. As the Peugeots are in a list with
other vehicle types I first need to identify Peugeot then identify that MPG
is not null, then count those cells.
  #2  
Old August 1st, 2008, 12:51 PM posted to microsoft.public.excel.worksheet.functions
Pete_UK
external usenet poster
 
Posts: 8,780
Default COUNT IF but not if 'X' IS NULL

You can use an array-entered AVERAGE(IF(... formula to do this - give
details of the columns used for the vehicle name and for the mpg and I
can give you the rest of it.

Pete

On Aug 1, 12:33*pm, Pyrite wrote:
Hi,

I have a list of vehicle types and a list of MPG figures. I want to do an
average MPG for each vehicle type so I need to know not only how many of the
vehicle type there are but also how many of that type of vehicle have an MPG
figure with them.

E.g. I have 132 Peugeot vehicles, if I total the MPG figures and divide by
132 that gives me the average but only if every one of the Peugeots has a
figure for that month which they dont. For this reason I need to know how
many of those 132 have a figure with them. As the Peugeots are in a list with
other vehicle types I first need to identify Peugeot then identify that MPG
is not null, then count those cells.


  #3  
Old August 1st, 2008, 01:05 PM posted to microsoft.public.excel.worksheet.functions
Pyrite
external usenet poster
 
Posts: 84
Default COUNT IF but not if 'X' IS NULL

The vehicle type coloumn is labelled 'Vehicle Type' and is from F13 to F500.
MPG column is 'MPG' and is G13 to G500. Thanks for your help

"Pete_UK" wrote:

You can use an array-entered AVERAGE(IF(... formula to do this - give
details of the columns used for the vehicle name and for the mpg and I
can give you the rest of it.

Pete

On Aug 1, 12:33 pm, Pyrite wrote:
Hi,

I have a list of vehicle types and a list of MPG figures. I want to do an
average MPG for each vehicle type so I need to know not only how many of the
vehicle type there are but also how many of that type of vehicle have an MPG
figure with them.

E.g. I have 132 Peugeot vehicles, if I total the MPG figures and divide by
132 that gives me the average but only if every one of the Peugeots has a
figure for that month which they dont. For this reason I need to know how
many of those 132 have a figure with them. As the Peugeots are in a list with
other vehicle types I first need to identify Peugeot then identify that MPG
is not null, then count those cells.



  #4  
Old August 1st, 2008, 01:17 PM posted to microsoft.public.excel.worksheet.functions
Pete_UK
external usenet poster
 
Posts: 8,780
Default COUNT IF but not if 'X' IS NULL

Okay, well let's say then that you have a list of vehicle types
somewhere else, eg starting in X1 with "Peugeot". Put this array*
formula in Y1

=AVERAGE(IF((F13:F500=X1)*(G13:G500""),G13:G500) )

* As this is an array formula, then once you have typed it in you need
to commit it using Ctrl-Shift-Enter (CSE) instead of the usual
Enter. If you do this correctly then Excel will wrap curly braces
{ } around the formula when viewed in the formula bar - you must not
type these yourself. If you need to amend/edit the formula you must
use CSE again.

If you have other vehicle types in cells below X1, then copy the
formula down column Y as appropriate.

If you want to know how many vehicles, the formula is very similar -
just change AVERAGE to COUNT, and use CSE again.

Hope this helps.

Pete

On Aug 1, 1:05*pm, Pyrite wrote:
The vehicle type coloumn is labelled 'Vehicle Type' and is from F13 to F500.

  #5  
Old August 1st, 2008, 01:41 PM posted to microsoft.public.excel.worksheet.functions
Pyrite
external usenet poster
 
Posts: 84
Default COUNT IF but not if 'X' IS NULL

That works splendidly thank you. I'm not sure how it works but a couple of
re-reads of the formula and I will figure it out and add it to my repatoire
for future use.

Thanks again

"Pete_UK" wrote:

Okay, well let's say then that you have a list of vehicle types
somewhere else, eg starting in X1 with "Peugeot". Put this array*
formula in Y1

=AVERAGE(IF((F13:F500=X1)*(G13:G500""),G13:G500) )

* As this is an array formula, then once you have typed it in you need
to commit it using Ctrl-Shift-Enter (CSE) instead of the usual
Enter. If you do this correctly then Excel will wrap curly braces
{ } around the formula when viewed in the formula bar - you must not
type these yourself. If you need to amend/edit the formula you must
use CSE again.

If you have other vehicle types in cells below X1, then copy the
formula down column Y as appropriate.

If you want to know how many vehicles, the formula is very similar -
just change AVERAGE to COUNT, and use CSE again.

Hope this helps.

Pete

On Aug 1, 1:05 pm, Pyrite wrote:
The vehicle type coloumn is labelled 'Vehicle Type' and is from F13 to F500.
MPG column is 'MPG' and is G13 to G500. Thanks for your help



"Pete_UK" wrote:
You can use an array-entered AVERAGE(IF(... formula to do this - give
details of the columns used for the vehicle name and for the mpg and I
can give you the rest of it.


Pete


On Aug 1, 12:33 pm, Pyrite wrote:
Hi,


I have a list of vehicle types and a list of MPG figures. I want to do an
average MPG for each vehicle type so I need to know not only how many of the
vehicle type there are but also how many of that type of vehicle have an MPG
figure with them.


E.g. I have 132 Peugeot vehicles, if I total the MPG figures and divide by
132 that gives me the average but only if every one of the Peugeots has a
figure for that month which they dont. For this reason I need to know how
many of those 132 have a figure with them. As the Peugeots are in a list with
other vehicle types I first need to identify Peugeot then identify that MPG
is not null, then count those cells.- Hide quoted text -


- Show quoted text -



  #6  
Old August 1st, 2008, 02:34 PM posted to microsoft.public.excel.worksheet.functions
Pete_UK
external usenet poster
 
Posts: 8,780
Default COUNT IF but not if 'X' IS NULL

You're welcome - thanks for feeding back.

Pete

On Aug 1, 1:41*pm, Pyrite wrote:
That works splendidly thank you. I'm not sure how it works but a couple of
re-reads of the formula and I will figure it out and add it to my repatoire
for future use.

Thanks again

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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