Average if a separate column has data

JOHANNA

New Member
Joined
May 12, 2005
Messages
39
I have a spreadsheet with our company's divisions in one column (B) and number of days to fill a position in a separate column (O). I need a formula that will allow me to average column O if column B has "Sales" in the cell.

I have tried to create a VLOOKUP formula, but I get 0 for the result when there is data in column O.

Any help is greatly appreciated!!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I have a spreadsheet with our company's divisions in one column (B) and number of days to fill a position in a separate column (O). I need a formula that will allow me to average column O if column B has "Sales" in the cell.

I have tried to create a VLOOKUP formula, but I get 0 for the result when there is data in column O.

Any help is greatly appreciated!!
Try one of these...

This array formula** will work in any version of Excel...

=AVERAGE(IF(B2:B100="Sales",O2:O100))

** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.

This normally entered formula will work in Excel 2007 and later...

=AVERAGEIF(B2:B100,"Sales",O2:O100)

Adjust the ranges to suit.
 
Upvote 0
I have a spreadsheet with our company's divisions in one column (B) and number of days to fill a position in a separate column (O). I need a formula that will allow me to average column O if column B has "Sales" in the cell.

I have tried to create a VLOOKUP formula, but I get 0 for the result when there is data in column O.

Any help is greatly appreciated!!

Some options...

=SUMIF(B:B,"Sales",O:O)/MAX(1,COUNTIF(B:B,"Sales"))

On Excel 2007 or later:

=IFERROR(AVERAGEIF(B:B,"Sales",O:O),0)
 
Upvote 0
I entered the formula like this
{=AVERAGE(IF(Detail!B:B="Sales",Detail!O:O,0))}

and received a respose of 3. There are three cells and they average 202.
 
Last edited:
Upvote 0
I entered the formula like this
{=AVERAGE(IF(Detail!B:B="Sales",Detail!O:O,0))}

and received a respose of 3. There are three cells and they average 202.
If you're using Excel 2003 or earlier then you can't use entire columns as range references in array formulas. Use smaller specific ranges.

Also, don't include the 0. That will cause incorrect results.

Array entered**:

=AVERAGE(IF(Detail!B2:B100="Sales",Detail!O2:O100))

** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.
 
Upvote 0
I did have a #NUM! error, but it was my fault, I didn't add the Detail! page to the formula for the O column. When I entered the page name it gave 3 instead of the #NUM1. I thought I could edit the reply before anyone had a chance to respond.

Thank you very much for your prompt responses. You're wonderful!
 
Upvote 0
I did have a #NUM! error, but it was my fault, I didn't add the Detail! page to the formula for the O column. When I entered the page name it gave 3 instead of the #NUM1. I thought I could edit the reply before anyone had a chance to respond.

Thank you very much for your prompt responses. You're wonderful!
Ok, thanks for the feedback! :cool:
 
Upvote 0

Forum statistics

Threads
1,224,531
Messages
6,179,379
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top