# Querying connected excel worksheet data

**URL:** <https://forums.toadworld.com/t/querying-connected-excel-worksheet-data/41172>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [July 13, 2018, 7:07am UTC](https://forums.toadworld.com/t/querying-connected-excel-worksheet-data/41172 "2018-07-13T07:07:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zentel1](https://avatars.discourse-cdn.com/v4/letter/z/ed8c4c/32.png) [@Zentel1](https://forums.toadworld.com/u/Zentel1)\
**Post date:** [July 13, 2018, 7:07am UTC](https://forums.toadworld.com/t/querying-connected-excel-worksheet-data/41172/1 "2018-07-13T07:07:31Z")

</div>

Hello,

Please i am trying to write Case statements to get data from a connected worksheet but i keep getting this error [Microsoft][ODBC Excel Driver] Syntax error (missing operator) in query expression. When i do Select \* from table or query specific fields it works fine but i am unable to use Case or IF. I can do this with my other connect SQL DB’s and oracle DB’s.

Please any assistance or help is greatly appreciated.

Thank you

---

<div class="post-metadata">

**Author:** ![john.mcgraw](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@john.mcgraw](https://forums.toadworld.com/u/john.mcgraw)\
**Post date:** [July 13, 2018, 7:16am UTC](https://forums.toadworld.com/t/querying-connected-excel-worksheet-data/41172/2 "2018-07-13T07:16:14Z")

</div>

If memory serves…the Excel ODBC driver doesn’t support CASE or IF. For whatever crazy reason in Jet connections it is IIF. If I remember correctly it should look something like this…

SELECT Name, IIF(Gender = ‘M’, ‘Male’,‘Female’) FROM Individual

---

<div class="post-metadata">

**Author:** ![hharwood](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/hharwood/32/10121_2.png) [@hharwood](https://forums.toadworld.com/u/hharwood)\
**Post date:** [July 13, 2018, 7:20am UTC](https://forums.toadworld.com/t/querying-connected-excel-worksheet-data/41172/3 "2018-07-13T07:20:18Z")

</div>

Excel does not support the CASE statement like many SQL databases do. I think you’ll have to use IIF in your select statement. I did a Google search and one good example I found was:

```auto
   SELECT
IIF(test_expression, value_if_true, value_if_false) AS FIELD_NAME
FROM
TABLE_NAME

```
