Average data in column IF specific text in another

iherndon

Board Regular
Joined
May 24, 2009
Messages
102
Having some trouble working this out, I keep getting #VALUE!.

I have two columns, Column A that indicates Staffed or Unstaffed, and Column B which has data I want to average. I'm attempting to enter a formula into a cell elsewhere that will basically only calculate the Column B data if Column A contains the text 'Staffed'.

Thanks for any assistance!
 
Aah that worked, thanks! Is there anything special to do in this example?

The keyword I want to use is for any cell that contains the letters 'delay'. <>delay obviously covers that, but I seem to be missing some that perhaps had additional letters such as 'delayed' being present in the field's text. Does it have to be exact; or can I <> the text 'delay' and 'delayed' with just 1 criteria?
We can use a wildcard like this...

=AVERAGEIFS(P9:P268, B9:B268, "Smith, John", J9:J268, "Staffed", X9:X268,"<>Delay*")
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I also have a similar dilemma. I want to do the same thing as the original poster, but I want to match specific text in TWO different columns. I tested out the "=AVERAGE(IF(B2:B100="Staffed",A2:A100))" CSE formula and it works great for matching one column, but I need to match data from column B AND from column C, then average the numbers in another column. I tried to nest the AND function and I couldn't get it to work. Can anyone please help me with this? Thanks!
 
Upvote 0
I also have a similar dilemma. I want to do the same thing as the original poster, but I want to match specific text in TWO different columns. I tested out the "=AVERAGE(IF(B2:B100="Staffed",A2:A100))" CSE formula and it works great for matching one column, but I need to match data from column B AND from column C, then average the numbers in another column. I tried to nest the AND function and I couldn't get it to work. Can anyone please help me with this? Thanks!

Control+shift+enter, not just enter:

=AVERAGE(IF(Range1=Cond1,IF(Range2=Cond2,AverageRange)))

Substitute the relevant ranges and cells for the placeholders this formula uses.
 
Upvote 0
I also have a similar dilemma. I want to do the same thing as the original poster, but I want to match specific text in TWO different columns. I tested out the "=AVERAGE(IF(B2:B100="Staffed",A2:A100))" CSE formula and it works great for matching one column, but I need to match data from column B AND from column C, then average the numbers in another column. I tried to nest the AND function and I couldn't get it to work. Can anyone please help me with this? Thanks!
Try one of these...

Book1
BCD
2WestYes27
3NorthNo38
4NorthNo73
5SouthYes83
6NorthYes61
7WestNo18
8SouthNo14
9WestNo96
10SouthYes63
11NorthYes86
12WestNo30
13WestYes5
14SouthNo38
15NorthYes45
Sheet1

We want to average column D where column B = North and column C = Yes.

This array formula** will work in ANY version of Excel:

=AVERAGE(IF(B2:B15="North",IF(C2:C15="Yes",D2:D15)))

** 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.

The normally entered formula will work in Excel 2007 and later:

=AVERAGEIFS(D2:D15,B2:B15,"North",C2:C15,"Yes")
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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