mcfurlong1
New Member
- Joined
- Mar 19, 2020
- Messages
- 3
I have a list of queries that I use rather frequently and the only thing that needs edited in those queries is essentially a list that the query is searching for. An example query is:
SELECT DISTINCT Title, owner, account_number
FROM table1
WHERE account_number in ('*Insert Account_numbers*')
I then have a list of Account_numbers on another tab in the excel document and I want to know if there is an easy way to have the query list work so it would automatically input the account_account number into the query. I understand I could do a =("SELECT DISTINCT Title, Owner, account_number FROM table1 WHERE account_number in ('& CELL# & "') but I want it to be more functional and also be able to input multiple account numbers, in single quotes, comma separated.
In the end I want the functionality to show the following when there are multiple account_numbers:
SELECT DISTINCT Title, owner, account_number
FROM table1
WHERE account_number in ('12345','58923',23985','19839')
SELECT DISTINCT Title, owner, account_number
FROM table1
WHERE account_number in ('*Insert Account_numbers*')
I then have a list of Account_numbers on another tab in the excel document and I want to know if there is an easy way to have the query list work so it would automatically input the account_account number into the query. I understand I could do a =("SELECT DISTINCT Title, Owner, account_number FROM table1 WHERE account_number in ('& CELL# & "') but I want it to be more functional and also be able to input multiple account numbers, in single quotes, comma separated.
In the end I want the functionality to show the following when there are multiple account_numbers:
SELECT DISTINCT Title, owner, account_number
FROM table1
WHERE account_number in ('12345','58923',23985','19839')