Using VLOOKUP with a connection to SQL instead of a query

apor

New Member
Joined
Dec 20, 2021
Messages
25
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,

In order to extract Data from SQL i have been using Queries. However, now i want to extract from a specific Database that is so large that it will never "refresh."
My solution was to use a connection instead of a query.

in the power query editor, i had this string in the header:
= Sql.Database("...", "...", [Query="select * from ... where ... like '%...' and ... like '...'"])
In order to extract the data i wanted, i had this string in my excel sheets:
=IF(B2="","",VLOOKUP(B2,Query1[[...]:[...]],13,FALSE))

Basically, i want to use the same process with a connection instead of a query so that i do not need to refresh anything but excel extracts the data directly if i enter a value into Field B2.

in the power query editor, my string looks like this:
= Source{[Schema="...",Item="..."]}[Data]
The Table of results that i get in the query editor is exactly the same.
Now i dont know how i should edit my string in cells so that i get the same results. If I use this string:
=IF(B2="","",VLOOKUP(B2,Connection1[[...]:[...]],13,FALSE)) where Connection1 is the name of the connection, I get an error message.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top