Skip to content

Tag: excel

Double sort in Excel or SQL

I have a weird table-sorting issue that I cannot figure out in Excel or SQL. Here’s a table sorted by column 2, “Letter”. Name Letter Dan A Moe A Ted B Dan C Joe F Noe F What I need is the table sorted by Letter BUT… if there are any duplicates in the “Name” column, I need …

VBA & SQL how to select specific values based on range in excel?

I am newbie in connection of vba (excel) and oracle database. I have tried to look for some information but I could not find anything that would work for me. I want to write a query that will return me only rows in which there is a specific values. My query looks like this: SQLStr = SQLStr = “SELECT NGK…

SQL in Excel: Cannot call declared variable

I am trying to breakdown my SQL string in Excel VBA, storing my variables in the first part of the SQL, and calling them in the second part. It seems that declared variables is not my friend here? First part(Declaring my variable) Second part(Calling my variable) Using a temp table works: But calling the vari…

Group by and display count in Excel

I am trying to learn some Excel’s features and I want to know if it is possible to make an SQL-like statement in Excel. For example, I distincted a dataset and the output is: I want to make a count(*) and a group by like: Answer Initial data: Create a pivot table. When you drag columns like this… …

SQL Query with Excel VBA

I’m trying to run a SQL query with Excel VBA. I got the query from someone else. When I run this query, I’m getting the following error message: “The SELECT statement includes a reserve word or an argument name that is misspelled or missing, or the punctuation is incorrect.” I can&#821…

Formatting in MS Access

I am trying to format a Access table fields to include all values as in the images below. However when I copy and paste from excel to the Access table, only significant figures appear in the table. …

How to change SQL queries in Excel using VBA?

I have a workbook connected to a database that has stock data. I have around 500 stock symbol data and I fetch them one by one by entering the stock symbol (pink highlighted) in the query as shown below. All the time I have to open Connection Properties then Definition to change the stock symbol. This process…

SQL statement in VBA Excel

I have a problem with a SQL Statement in VBA Excel. I can’t use ORDER BY together with GROUP BY and I don’t understand why. If I delete ORDER BY I don’t get errors. Can anyone help me figure out where am I wrong? Thanks a lot to everyone!! Here is my code: Answer missing space ? try with