Excel VBA Introduction Part 58.2 - SQL for Excel Files - Sorting Rows in a Query

preview_player
Показать описание


This video explains how to add an Order By clause to sort the results of your SQL queries when selecting data from an Excel file. You'll learn how to sort single and multiple columns by name in both ascending and descending order. You'll also see how to sort a query when the source data has no column headers and how to sort by a column without displaying it in the query results.

Chapters
00:00 Topic List
00:35 The Basic Setup
02:47 Sorting by a Single Column
03:54 Sorting by Multiple Columns
05:26 Sorting in Descending Order
06:30 Mixing Ascending and Descending Sort Orders
07:40 Sorting by Fields without Column Headers
09:24 Assigning Aliases to Columns
11:49 Aliases Cannot be used in the Order By Clause
12:42 Sorting by Column Index
14:10 Sorting by Hidden Columns
15:24 What's Next?

Рекомендации по теме
Комментарии
Автор

Thank you so much! Neat coding and easy explaining..Your voice is the best.

elliekim
Автор

You bring real "ORDER!" into my chaotic sql.

thwbn
Автор

Detailed and extensive explanation ... Thank you, Andy.

youssefsedkey
Автор

Awesome. Thanks a lot for these incredible tutorials. Your channel is the best.

KhalilYasser
Автор

Amazing!! I'm learning a lot with your videos!! Thank you so much!

xaviruiz
Автор

Good Day Andrew! is it possible to to create a dialog box where you can set the query parameters? Folder, files, field names, where clauses etc...

donbogdala
Автор

Thanks for the "ORDERED BY" video. Can we also Custom sort just like Excel CustomList sorting i.e. sorting Movies data by "Run Time" Field based on Array(90, 120, 80). Hope this makes sense.

imranbhatti
Автор

Wonderful video soon can we have insert data in closed excel will be helpful

Why I need this because I having 260 excel I need to open every file and check the data is found or not using simple if statement if not I need enter the data empty one on particular cell, currently I developed macro which open every file and perform the task then saves file it takes more than 30 mins and some time macro stops to speed up the task I need to make this using sql



Will this be possible ?

pannerselvammaruthachalam
Автор

Do we need to make any setup before using sql query scripts in vba?

gurqhan
Автор

Hi sir your video is so fantastic. I have only one question though. I am trying to use query to sort column with time data like for example 7:30 am. However the result of the query did not return the time value it return decimal number and it did sort the time accurately I hope you can answer my query.thanks alot and more power to you.

andrianidanol
Автор

Hi. I have a question. i would like to sort my query by a table, which i have in my worksheet. for example, instead of writing ORDER BY Switch(" & _
" f.[Date] = '0-30', 1" & _
", f.[Date] = '31-60', 2" & _
", f.[Date] = '61-120', 3" & _
", f.[Date] = '121-360', 4" & _
", f.[Date] = '360+', 5" & _
", True, 7) ASC" I would like to have this 'sorted list' in excel table and sort this query by the table, which i have in my worksheet. Is that possible? Thank you very much for your time! You are the best!

grzegorz
welcome to shbcf.ru