AverageIF

Bahaa

New Member
Joined
Oct 3, 2013
Messages
46
I have cells where i need to calculate average but if text was included in certain cells, then i need the formula to show error or "please fill number" so to get alert that number is missing and need to be filled
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try something on the lines of
Excel Formula:
=IF(COUNT(range)=5,AVERAGE(range),"error message")
where = 5 refers to the number of cells in the range that should contain numbers.
 
Upvote 0
I started with this
=AVERAGEIF($G$5:$BF$5,">=0") then incase text entered in cells then i need the formula to turn into "please fill in number instead of text" so the average will be calculated properly. Plus i need to eliminate error #NA or #Div in formula as well

Appreciate if anyone can help.
 
Upvote 0
Try something on the lines of
Excel Formula:
=IF(COUNT(range)=5,AVERAGE(range),"error message")
where = 5 refers to the number of cells in the range that should contain numbers.
Thanks Jason, but dont need to limit myslef with only 5 cells, with your formula i need to fill numbers in all my 52 cells to calculate average. can you help over this ?
 
Last edited:
Upvote 0
5 was just an example, you can change it to 52 to match your range.
 
Upvote 0
5 was just an example, you can change it to 52 to match your range
Yes i know, but i do not want to be obliged to fill the cell with number cuz this will be filled every week and do not need to change it every time i want to fill the coming 5 next cells. Example your formula covers only 5 cells, if i change it to 52 and did not fill the remaining 47 cells then the formula will give the error message.
 
Upvote 0
Try
Excel Formula:
=IF(COUNT(range)=COUNTA(rng),AVERAGE(range),"text found")
This will check that all cells either contain a number or are empty.
You may still get an error if all are empty or there are no numbers other than 0, if that happens then this will mask the #Div/0 error
Excel Formula:
=IF(COUNT(range)=COUNTA(rng),IFERROR(AVERAGE(range),"No numbers"),"Text found")
 
Upvote 0
Solution
Try
Excel Formula:
=IF(COUNT(range)=COUNTA(rng),AVERAGE(range),"text found")
This will check that all cells either contain a number or are empty.
You may still get an error if all are empty or there are no numbers other than 0, if that happens then this will mask the #Div/0 error
Excel Formula:
=IF(COUNT(range)=COUNTA(rng),IFERROR(AVERAGE(range),"No numbers"),"Text found")
Thanks Jason
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,047
Members
449,064
Latest member
scottdog129

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