+ Reply to Thread
Results 1 to 13 of 13

Converting QUERY formula to EXCEL

  1. #1
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Converting QUERY formula to EXCEL

    I had created a QUERY formula in Google Sheets and now trying to convert over to Excel. Since Excel doesn't have the equivalent "QUERY", I have attempted a couple of different workarounds, but cannot seem to get the desired results.

    The formula queries a table and returns data based on the value in one or another column (desired value can be in one of two columns) and is as follows.

    =QUERY(Sales!$A$3:$R$332,"SELECT A,B,C,D,H,I,J,K,L,M,N,O,P,Q,R WHERE F ='John Melvin' OR G = 'John Melvin'",1)

  2. #2
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Re: Converting QUERY formula to EXCEL

    Attached Workbook
    Attached Files Attached Files

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Converting QUERY formula to EXCEL

    could you explain what you are trying to do with the query AND where it goes (so I don't have to click on every cell in the 6 tabs)?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Re: Converting QUERY formula to EXCEL

    Sorry, "Sales" will be the data entry and the data will be displayed in "John Melvin".

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: Converting QUERY formula to EXCEL

    Many of us here do not work in Google Sheets and I in particular do not understand exactly what you are trying to do. Suggest you explain in plain/simple English exactly what you want to happen. An example to accompany your explanation would be very beneficial.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Re: Converting QUERY formula to EXCEL

    I'm pulling data from the table in "Sales" for the specific salesperson "John Melvin" and displaying that info in the sheet titled "John Melvin". The salesperson can be listed in either Salesperson #1 or Salesperson #2.

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Converting QUERY formula to EXCEL

    so you are not summing the data (and counting the dates) but rather you want to pull forward a line by line itemization of what John did if he was the sales person either 1 or 2, for each category, is that correct?

  8. #8
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Re: Converting QUERY formula to EXCEL

    Yes, you are correct.

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Converting QUERY formula to EXCEL

    So if you put John Melvin in cell N1 of the John Melvin tab I assume everything is supposed to work off that cell?
    AND, what about the month in cell N2, is everything to populate the John Melvin tab supposed to be from a given month based on N2?
    Is the John Melvin tab just a sample tab and not really representative of John, in other words should the formula be variable to pull out Jeff Bennett if his name populates that cell? Or are you going to have a tab for every sales rep?

  10. #10
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Re: Converting QUERY formula to EXCEL

    Yes, it should work off that Cell if possible or at least I would prefer it to do so. In Google Sheets, the name had to be in the formula itself using "Query", it wouldn't be a problem moving forawrd either, I would just create a sheet for each salesperson.

    Also yes that John Melvin is a sample, I will need to do the same for each salesperson. As mentioned above, I simply created a sheet titled for each salesperson which was not a problem. I had removed the other salesperson tabs so that I could just duplicate the one titled John Melvin and change the formulas to the desired Reps.

    The month cell N2 was populated by the date in the first entry, cell A5. So if the data returned was 12-5, the month "December, 2019" would populate.

  11. #11
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Re: Converting QUERY formula to EXCEL

    For clarification, the formula in A4 is how excel converted the original formula from Google Sheets. This was not something I was attempting.

    The original read as =QUERY(Sales!$A$3:$R$332,"SELECT A,B,C,D,H,I,J,K,L,M,N,O,P,Q,R WHERE F ='John Melvin' OR G = 'John Melvin'",1)

    Which says go to table "Sales A3:R332, selecting columns A,B,C,D.... where Column F or G is "John Melvin".

    This would then pull the headers and data associated with John Melvin in either Salesperson #1 or Salesperson #2
    Last edited by Jaxdad; 12-12-2019 at 03:00 PM.

  12. #12
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Converting QUERY formula to EXCEL

    as I think about it I think it will be a series of somewhat complex array formulas but I would think that a pivot table would be the answer for your needs.

  13. #13
    Registered User
    Join Date
    12-12-2019
    Location
    Illinois, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    8

    Re: Converting QUERY formula to EXCEL

    That seems to be where I see it heading as well, I just didn't know if I was missing something more simple. I've not used Excel for many years and although much is similar, still getting re-acquainted with Excel and changing the thought process is a challenge at times.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Power Query - Converting a query into a function
    By kersplash in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-29-2019, 12:17 AM
  2. Need help converting an Excel formula to an Access Query
    By bbeards in forum Access Tables & Databases
    Replies: 4
    Last Post: 04-02-2018, 04:37 PM
  3. [SOLVED] Converting Google Sheets QUERY to Correct Excel Formula
    By davis909 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-17-2017, 09:14 AM
  4. Query in Converting text to rows
    By jayeshk in forum Excel General
    Replies: 3
    Last Post: 12-21-2015, 01:43 AM
  5. [SOLVED] Converting Google Sheets document with query to Excel
    By playmate in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 08-04-2015, 10:18 PM
  6. Conversion failed when converting date - SQL Query.
    By gawcio90 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-08-2015, 01:13 PM
  7. [SOLVED] Converting Query Table to ListObject
    By x10sion in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2013, 06:56 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1