Search code examples
google-sheetsgoogle-sheets-formula

Average values with specific parameters


In Google Sheets I have data in the range Sheet3!A:C as pictured below:

Sample Sheet3 data

I would like to average the values in "Volume (ml)" (range Sheet3!C:C), by unique combination of "ID Primary" and "Date".

Below is an example of my expected output based on the sample data above.

Example desired results


Solution

  • Alternate Formula:

    Based on your given data, this formula uses Query and Substitute to convert the volume data from comma-separated to period-separated decimal and display the average volume per ID and Date

    =SORT(ARRAYFORMULA(QUERY({Sheet1!A:B, IFERROR(VALUE(SUBSTITUTE(Sheet1!C:C, ",", ".")))}, "SELECT Col1, Col2, AVG(Col3) WHERE Col1 IS NOT NULL GROUP BY Col1, Col2 LABEL AVG(Col3) 'Average Volume (mL)'",1)), 1, False)
    

    Result:

    image

    Note: Please adjust the Sheet name accordingly that suits your google sheets

    References:

    Query Function

    Substitute