Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Google Sheet: Formula - Alternative to =ArrayFormula(AVERAGE(QUERY()))

$
0
0

I'm encountering issues with using the =ArrayFormula(AVERAGE(QUERY())) combination in Google Sheets. It seems that the ArrayFormula() function doesn't work with QUERY() or AVERAGE(). I'm also considering using VLOOKUP(), but I'm having trouble implementing it.

My goal is to track tippers and their tipping performance using a data sheet that includes columns for LAST NAME, PHONE NUMBER, SUB, TOTAL, TIP, and PERCENTAGE. The TIP and PERCENTAGE columns should be calculated using formulas. Now, I want to extract unique data for LAST NAME and PHONE NUMBER from the data sheet to an average sheet.

Here's a sample of the data in the data sheet before the transformation:

LAST NAMEPHONE NUMBERSUBTOTALTIPPERCENTAGE
Smith(123) 456-7890$28.66$32.96$4.3013.05%
Johnson(987) 654-3210$58.68$68.68$10.0014.56%
Williams(555) 123-4567$35.48$40.48$5.0012.35%
Jones(111) 222-3334$52.22$55.00$2.785.05%
Smith(123) 456-7890$50.82$70.82$20.0028.24%
Johnson(987) 654-3210$51.23$58.68$7.4512.70%
Williams(555) 123-4567$33.47$35.47$2.005.64%
Jones(111) 222-3334$44.27$50.91$6.6413.04%

I want to transform this data into the following format in the average sheet:

LAST NAMEPHONE NUMBERPERCENTAGE
Smith(123) 456-789020.64%
Johnson(987) 654-321013.63%
Williams(555) 123-45679.00%
Jones(111) 222-33349.05%

I would like this formula to be placed in the top cell of the average sheet and propagate down as new data is added to the data sheet. This will ensure that the averages are updated automatically. I would prefer to avoid dragging the formula down and my scripting is broken for some reason so that is no longer an option.

The formula =ARRAYFORMULA(IF(A2<>"",AVERAGE(QUERY(Data!A2:F, "SELECT F WHERE (A = '"&A2&"' AND B CONTAINS '"&B2&"')")),IFERROR(1/0))) I tried using doesn't work. Additionally, I'm considering using VLOOKUP() but need help with the implementation.

To provide more context and facilitate the process, I have prepared an editable Google sheet containing all generated data. You can access it through the following link: Google Sheet Link.

Can someone assist in rewriting the formula or suggest an alternative approach to achieve the desired result?

Thank you in advance for your help!


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>