Return cell value if only 1 result is found, or average if more than 1 result

paun_shotts

New Member
Joined
Nov 4, 2021
Messages
38
Office Version
  1. 2013
Platform
  1. Windows
Hi,

Im having some troubles in creating a formula and hope someone can help me out.

I want to get the average winning margin of NBA sports games if certain criteria are met. I can get it working using AVERAGEIFS formula, but in the case that one team have played another team only 1 time, it cannot return the average of that event, and is returning an error.

If there is only 1 game played between two teams, I want to return that 1 winning margin, if there are more than 1 games, then return the average winning margin of all games between the two teams.

Below is the formula that I have so far:
=AVERAGEIFS('NBA Model'!$S:$S,'NBA Model'!$BD:$BD,A19,'NBA Model'!$T:$T,H18)
Column S shows the winning margin on the sheet "NBA Model"
Column BD shows the game between two teams, eg, "DET v ATL"
Column T shows the team that won
So above we are averaging the winning margin (column S), of the game "DET v ATL",where ATL is the winner of the game (column T)

I have a few screenshots to help out with this. The result returned should be "-25"

Thanks for your help.
 

Attachments

  • Screen1.png
    Screen1.png
    7.8 KB · Views: 13
  • Screen2.png
    Screen2.png
    26.4 KB · Views: 13

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Nevermind, I have worked out a workaround for this, using an if statement to see if the number of games played is greater than or less than and equal to 1, then if less than or equal to 1, do sumifs, if more than 1, do averageifs
 
Upvote 0
You shouldn't need a workaround - AVERAGEIFS will cope perfectly well with one match.

There is something else causing the problem. It looks like you have merged cells in column BD, which may play havoc with your results. I'd start looking there!
 
Upvote 0
Solution

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,060
Latest member
mtsheetz

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