How to use Calculate average with multiple criteria and ignore text

alantse2010

New Member
Joined
Jun 9, 2018
Messages
34
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
Hello all, i want to calculate the average refer the contractor name and ignore the text "NA".
I know that it needs to use averageifs to calculate but it shows the #DIV/0! error if the data contain text or no text
Would you please tell me how to fix it?
I had wrote down my formula and the result in below
Thank you
Sheet1:
ContractorMeet or exceed customer’s requirements2Manpower Resources of subcontractor2Cooperative of Subcontractor’s staff2Adequate safety measures2
WY
4​
4
5​
4
AT
4​
NA
4​
NA
TS-SP
4​
3
5​
4
TS-SP
5​
3
4​
NA
AT
3​
3
3​
3
TS-SP
2​
2
2​
2
WY
4​
4
4​
4
TS-WS
3​
2
4​
4
WL
5​
5
5​
5
YF
1​
1
1​
1

Sheet2:
Result:
ContractorAverage mark of adequate safety measures 2
AT=AVERAGEIFS(Sheet1[Adequate safety measures2],Sheet1[Contractor],"AT",
Sheet1[Adequate safety measures2],"<>NA")
TS-SP=AVERAGEIFS(Sheet1[Adequate safety measures2],Sheet1[Contractor],"TS-SP",
Sheet1[Adequate safety measures2],"<>NA")
WY

TS-WS
YF

WL

 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
@alantse2010 Might this help?
It is an Array formula.

MRXLMAY21 (version 1).xlsb
ABCDEFG
1Product CodeContractorMeet or exceed customer’s requirements2Manpower Resources of subcontractor2Cooperative of Subcontractor’s staff2Adequate safety measures2Average Ignoring Text Other Than Number As Text
2ABC123WY44544.25
3AT444NA4
4TS-SP43544
5TS-SP534NA4
6AT33333
7TS-SP22222
8WY44444
9TS-WS32443.25
10WL55555
11YF11111
Sheet3
Cell Formulas
RangeFormula
G2:G11G2=SUMPRODUCT((IFERROR(C2:F2*1,0)))/SUMPRODUCT(ISNUMBER(C2:F2*1)*1)
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi Alantse2010,

Your example seems to work OK (although I'm using an earlier Excel version). If all the entries for a Contractor are NA then yes, you will get a #DIV/0 error but you can trap that with an IFERROR.

Book1
ABCDE
1ContractorMeet or exceed customer’s requirements2Manpower Resources of subcontractor2Cooperative of Subcontractor’s staff2Adequate safety measures2
2WY4454
3AT4NA4NA
4TS-SP4354
5TS-SP534NA
6AT3333
7TS-SP2222
8WY4444
9TS-WS3244
10WL5555
11YF1111
Sheet1


Book1
AB
1ContractorAverage mark of adequate safety measures 2
2AT3
3TS-SP3
4TS-WS4
5WL5
6WY4
7YF1
Sheet2
Cell Formulas
RangeFormula
B2:B7B2=IFERROR(AVERAGEIFS(Adequate_safety_measures2,Contractor,A2,Adequate_safety_measures2,"<>NA"),0)
Named Ranges
NameRefers ToCells
Adequate_safety_measures2=Sheet1!$E$2:$E$11B2:B7
Contractor=Sheet1!$A$2:$A$11B2:B7
 
Upvote 0
Solution
@Snakehips thank you for your reply, I tried your formula, it is successful to calculate the average and pass the text"NA" but the directional should be calculated from F2:F11 and refer to the contractor Name
@Toadstool Thank you for your reply, I tried your formula, I think your formula is right but I don't know why it is still showing "#DIV/0!", so I copy the data to another sheet and clear NA and calculate again, it works, thank you
 
Upvote 0
@Snakehips thank you for your reply, I tried your formula, it is successful to calculate the average and pass the text"NA" but the directional should be calculated from F2:F11 and refer to the contractor Name
@Toadstool Thank you for your reply, I tried your formula, I think your formula is right but I don't know why it is still showing "#DIV/0!", so I copy the data to another sheet and clear NA and calculate again, it works, thank you
You're welcome!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

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