Excel Function : AVERAGEIF
Returns the average (arithmetic mean) of all the cells in a range that meet a given criteria
Microsoft Excel Reference Page
Syntax and Description of the AVERAGEIF Excel Function
I want to get average of a column by using if statement. i.e. if value of column = 1 then average of all values which are equal to 1. I am using sql server. Please help. Thanks in advance. A: You can use
AVERAGEIF function in SQL Server
About AVERAGEIF Excel Function
The AVERAGEIF function calculates the average of all cells that meet a certain criteria. The syntax for the AVERAGEIF function is: AVERAGEIF(range, criterion, [average_range]) Range is the range of cells that you want to evaluate. Criterion is the criteria that you want to use to determine which cells to include in the average. Average_range is an optional argument that specifies the range of cells to average. If omitted, the cells in range are used.