Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Imbed SQL in Excel ?

Is there any way to use SQL directly inside Excel to return a value from a
table to a cell, both in the same worksheet, without using ODBC?

I seem to remember being able to do this in 123.

I would prefer to do this by entering the SQL into a cell, but a VBA
function would work also.

Any help would be appreciated. I'm a mainframe guy, a little lost in Excel
trying to help my daughter.

In case you wonder why: I want to look up a value in a table that is 3 cols
by 30,000 rows. I need to match two columns and return the third. I tried
to convert the table to two dimensions with the pivot table wizard, but
although it seemed to work, it discarded many chunks of data. I know SQL a
lot better than I know Excel's lookup functions. This needs to run on a
version of Excel without the ODBC add in, and no authority to ad it in.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Imbed SQL in Excel ?

Hi Biff,

From my experience, using SQL queries on an open workbook can cause issues.
It is possible, but I think you can accomplish this in other ways. The DGET
worksheet function may do what you want. Or you could use an array
function. If you look in help under "DGET Worksheet Function", you will see
a pretty good example of how to use it.

Using an array function, you could do something like this:

=MAX((A2:A100="Jake")*(A2:B100="Marx")*(C1:C100))

*Array formulas must be entered with Ctrl+Shift+Enter

This array formula will return the unique ID (residing in column C) of an
employee named "Jake Marx" (where first name resides in column A and last
name resides in column B). If there are multiple records matching your 2
criteria, then this would not be a good approach (but neither would DGET),
as it would return the highest ID of the matching records. No matching
records will result in a zero value.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Biff Canlett wrote:
Is there any way to use SQL directly inside Excel to return a value
from a table to a cell, both in the same worksheet, without using
ODBC?

I seem to remember being able to do this in 123.

I would prefer to do this by entering the SQL into a cell, but a VBA
function would work also.

Any help would be appreciated. I'm a mainframe guy, a little lost in
Excel trying to help my daughter.

In case you wonder why: I want to look up a value in a table that is
3 cols by 30,000 rows. I need to match two columns and return the
third. I tried to convert the table to two dimensions with the pivot
table wizard, but although it seemed to work, it discarded many
chunks of data. I know SQL a lot better than I know Excel's lookup
functions. This needs to run on a version of Excel without the ODBC
add in, and no authority to ad it in.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
imbed Word document in EXCEL slamjamm Excel Discussion (Misc queries) 1 December 12th 08 08:38 PM
Can I imbed a Word Document into an Excel Workbook? ChyTown1017 Excel Discussion (Misc queries) 3 December 8th 05 08:36 PM
Excel should let me imbed documents and programs within its-self stix32895 Excel Worksheet Functions 0 May 29th 05 10:48 PM
Imbed Linked Word doc in Excel so whole doc shows? 2ndchinv Excel Discussion (Misc queries) 3 May 17th 05 08:24 PM
How do I imbed a Word document into an Excel cell? Baxter Excel Discussion (Misc queries) 2 March 12th 05 01:55 PM


All times are GMT +1. The time now is 04:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"