Here is my query. I want "select * limit 5") the 5 to come from a cell. How do I do that?

=ArrayFormula(AVERAGE(QUERY(SORT(Tabell!D4:D33,ROW(Tabell!D4:D33)*ISNUMBER(Tabell!D4:D33),0),"select * limit 5")))

  • Welcome to Web Applications. It's not clear what is your question about. Please add some sample data input and the expected result. – Rubén Jul 28 at 20:18

Use the following, assuming the limit is on cell A1

=QUERY(SORT(Tabell!D4:D33,ROW(Tabell!D4:D33)*ISNUMBER(Tabell!D4:D33),0),"select * limit " & A1)))
| improve this answer | |

Please use the following formula:

=ArrayFormula(AVERAGE(QUERY(SORT(Tabell!D4:D33,ROW(Tabell!D4:D33)*ISNUMBER(Tabell!D4:D33),0),"select * limit "&D2&"")))

(where D2 is the cell containing 5)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.