Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Has anyone successfully used the Case statement in a select query using MS
SQL within Excel , looking at an excel file as a datasource? I'd love for you to post a sample query that you got to work. I've followed the syntax every which way and it doesnt seem to work on this configuration. Much appreciated ! |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Not sure if this is what you want/need but it works for me in a macro.
Sub test() Dim MWS As Worksheet, X As String Set MWS = ThisWorkbook.Worksheets(1) Select Case MWS.Range("A1") Case 1 MsgBox "case was 1" Case 2 MsgBox "case was 2" Case 3 MsgBox "case was 3" Case Else MsgBox "case was not 1 or 2 or 3" End Select End Sub Hope that is a start. "ForestFeeder" wrote: Has anyone successfully used the Case statement in a select query using MS SQL within Excel , looking at an excel file as a datasource? I'd love for you to post a sample query that you got to work. I've followed the syntax every which way and it doesnt seem to work on this configuration. Much appreciated ! |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thanks Bill,
Unfortunately I need to use SQL in Microsoft Query within Excel. I have an excel file ( A ) which acts as a database. Another excel file ( B ) is a report that queries the database ( A ). My SQL query requires the use of a case statement. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Until you posted this I hadn't tried. However, now that I've tried it isn't
looking so good. A simple case select that runs fine in SQL Server Query Analyzer returns no records when run against an Excel file containing the same SQL data. I can't even get MS Query to accept a rudimentary CASE statement "ForestFeeder" wrote: Has anyone successfully used the Case statement in a select query using MS SQL within Excel , looking at an excel file as a datasource? I'd love for you to post a sample query that you got to work. I've followed the syntax every which way and it doesnt seem to work on this configuration. Much appreciated ! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count colored cells? | Excel Worksheet Functions | |||
color coding | Excel Worksheet Functions | |||
VBA Code | Excel Discussion (Misc queries) | |||
EXCEL:NUMBER TO GREEK WORDS | Excel Worksheet Functions | |||
reminder notifications in a column | Excel Discussion (Misc queries) |