Search code examples
splitgoogle-sheetsworksheet-functionarray-formulas

Parse Cells in Spreadsheet and get Geometric mean


I have a google spreadsheet with entries like this:

| 102584 (46.93%) | 15561 (7.12%) | 15709 (7.19%) | 33358 (15.26%) 

| 102522 (46.90%) | 15561 (7.12%) | 15709 (7.19%) | 33358 (15.26%) 

I want to grab the raw numbers beside the parentheses across a whole row and get the geometric mean for that row. What I have right now is:

=geomean(arrayformula(index(split(G3:AQ3,"()"),0,1)))

So I try to split each cell by parentheses, index into the first element in the parsed array, operate on the whole range as an array with arrayformulta (otherwise it seems to add the raw number to the raw percent), and then get the geomean. But this seems to only work on the first cell of the range. If I tried operating on a column instead of a row, it seems to work, but I can't get the operations to work on a row for some reason. Is there any advice?

Thanks


Solution

  • The whole splitting doesn't really work, try this instead

    =GEOMEAN(ARRAYFORMULA(REGEXEXTRACT(A3:D3, "^[0-9]+") + 0))