1

I want to pass in ARRAYFORMULA into the QUERY so that I can get the sum without splitting the two functions apart.

I want to do this but getting an error ("unable to parse query string for function query parameter"):

=QUERY(ARRAYFORMULA(SPLIT(O5:O7, " to ")),"select sum(O),sum(P)")

Example:

This is the input:

1.080 to 3.240
0.771 to 2.312
0.721 to 2.164

Above input is pass in as O5:O7. Using this function, it will split into 2 columns and extract the number:

=ARRAYFORMULA(SPLIT(O5:O7, " to ")

As result, shown as following:

1.08    3.24
0.771   2.312
0.721   2.164

The above result will be pass into as O18:P20. This function will give the sum of each columns:

=QUERY(O18:P20,"select sum(O),sum(P)")

Result as the following:

sum     sum 
2.572   7.716

Could I pass in the arrayformula's result into the query?

2 Answers 2

1

Use BYCOL() lambda function after splitting. Try-

=BYCOL(INDEX(SPLIT(P5:P7," to ")),LAMBDA(x,SUM(x)))

Or QUERY() function like-

=QUERY(INDEX(SPLIT(P5:P7," to ")),"select sum(Col1),sum(Col2)")

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

Yes:

=ARRAYFORMULA(QUERY(SPLIT(O5:O7, " to "), "select sum(Col1),sum(Col2)"))

If you don't need labels:

=INDEX(QUERY(SPLIT(O5:O7, " to "), "select sum(Col1),sum(Col2)"), 2)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.