Search code examples
google-sheetsgoogle-sheets-formulaweighted-average

Use cell content as values for a weighted.average formula in google sheets


I want to use the content of a cell as values of weighted.average formula in google sheet.

Example:

Cell A1 manually input values: 10,2,50,3,60,1 That means 10x2 + 50x3 + 60x1

Cell F1 put the formula: =weighted.average( [contents from A1] ) The result must be 38.33

I don't know how to concatenate this.

I've tried to use =weighted.average(text(A1)), =weighted.average(cell("contents",A1))

No results


Solution

  • try:

    =LAMBDA(ax,AVERAGE.WEIGHTED(QUERY(ax,"SELECT * SKIPPING 2"),QUERY({2^99;ax},"SELECT * SKIPPING 2 OFFSET 1")))(TRANSPOSE(SPLIT(A1,",")))

    -

    enter image description here