SQL Select Statement in Excel

  • Thread starter Thread starter agustina_s
  • Start date Start date
A

agustina_s

Hi is there anyway to create macro/ VBSCript to execute SQL Selec
statement in Excel Column.

Eg.

Select FirstName where LastName in ('Smith','Anderson')

I have an excel spreadsheet1 with Column A = FirstName and B
LastName
And then in another spreadsheet2 I want to look up value t
spreadsheet1.

Is there any tutorial regarding this?
I tried to search for it but to no avail :S.

Any suggestion is welcome.
Thanks in advanced.

Regards

Agustin
 
SQL - depends if they are in the same workbook. if the sheets are in
different workbooks, you can use MS Query to get external data from a closed
Excel workbook (either from the 1st sheet or a named range)

if its in the same workbook, try using an advanced filter they would look
like

FIRST_NAME LAST_NAME
Smith
Anderson

using 2 lines is basically an 'or' statement

you could also use a lookup function if you want to do it within a formula.
a workaround alternative to the SQL "in" statement is FIND where you say

=if(FIND("Smith","Smith,Jones")>0,FIRST_NAME,"")

This potentially lets you work within a formula

hope this helps - voodooJoe
 
Hi,

Try to use VLookup formaulae in excel, hope this helps to lookup the
value.

Warm regards,
Di$c0ver
 
Look at my answer to the post of 2 December 2005:
Count duplicates in an array?

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top