0

A little help to do the following:

I am good with Queries however, can't find if it is possible to do the following:

=Query(range, "Select * where B begins with (**want a range from A to Can**) to query by last names within the letters A to Can. Hope that makes sense.

1 Answer 1

2

Use the following as your "Select" clause:

"Select * Where UPPER(B) >= 'A' AND UPPER(B) < 'CANZ'"

I followed CAN with Z so that all words beginning with CAN would be selected (e.g., "Canada," "canopy," etc.).
I could have entered CAO to get the same results here, since every word beginning with CAN... will fall before CAO alphabetically.

The gist here is that, because all alphanumeric characters exist on the ASCII chart, they can be compared as equal, greater-than or less-than just like true numbers.

2
  • Excellent solution. Kudos Erik :) Feb 13, 2021 at 22:36
  • Thanks, @marikamitsos.
    – Erik Tyler
    Feb 14, 2021 at 1:17

Your Answer

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

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