ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format SQL Query results in Excel (https://www.excelbanter.com/excel-programming/434844-format-sql-query-results-excel.html)

Richard Brust

Format SQL Query results in Excel
 
I will have a query that returns a lot of similiar fields per row, think:

Name1 Info1 Extra1
Name1 Info1 Extra2
Name1 Info1 Extra3
Name2 Info2 Extra4
Name2 Info2 Extra5

I'd like to be able to format it as such:

Name1 Info1 Extra1
Extra2
Extra3
Name2 Info2 Extra4
Extra5

Basically, remove repeating data withing a "set". I know how to do it via SQL (thanks to some help), but not within Excel. Thanks!

EggHeadCafe - Software Developer Portal of Choice
..NET Beginner's Guide To UI, Business, Data Layers
http://www.eggheadcafe.com/tutorials...-guide-to.aspx

joel

Format SQL Query results in Excel
 
You may be able to put the SQL statements into the query you have in excel.
Excel has a built-in query editor that allows you to enter SQL. In excel
2003 it is located at the following menu.

First select any cell in a returned query

Data - Import External Data - Inport Data - Edit Query

Then look for the SQL box in the edit Query Menu.

"Richard Brust" wrote:

I will have a query that returns a lot of similiar fields per row, think:

Name1 Info1 Extra1
Name1 Info1 Extra2
Name1 Info1 Extra3
Name2 Info2 Extra4
Name2 Info2 Extra5

I'd like to be able to format it as such:

Name1 Info1 Extra1
Extra2
Extra3
Name2 Info2 Extra4
Extra5

Basically, remove repeating data withing a "set". I know how to do it via SQL (thanks to some help), but not within Excel. Thanks!

EggHeadCafe - Software Developer Portal of Choice
..NET Beginner's Guide To UI, Business, Data Layers
http://www.eggheadcafe.com/tutorials...-guide-to.aspx


EricG

Format SQL Query results in Excel
 
In Excel, the easiest way to get the formatting you describe is to convert
your data into a pivot table. A pivot table will naturally remove the repeat
values (leaving them blank) and will organize the data as you show in your
example.

HTH,

Eric

"Richard Brust" wrote:

I will have a query that returns a lot of similiar fields per row, think:

Name1 Info1 Extra1
Name1 Info1 Extra2
Name1 Info1 Extra3
Name2 Info2 Extra4
Name2 Info2 Extra5

I'd like to be able to format it as such:

Name1 Info1 Extra1
Extra2
Extra3
Name2 Info2 Extra4
Extra5

Basically, remove repeating data withing a "set". I know how to do it via SQL (thanks to some help), but not within Excel. Thanks!

EggHeadCafe - Software Developer Portal of Choice
..NET Beginner's Guide To UI, Business, Data Layers
http://www.eggheadcafe.com/tutorials...-guide-to.aspx


Richard Brust

Format SQL Query results in Excel
 
Note: the Extra2/3/5 is supposed to be under the other Extra "columns", not left-aligned.



Richard Brust wrote:

Format SQL Query results in Excel
12-Oct-09

I will have a query that returns a lot of similiar fields per row, think:

Name1 Info1 Extra1
Name1 Info1 Extra2
Name1 Info1 Extra3
Name2 Info2 Extra4
Name2 Info2 Extra5

I'd like to be able to format it as such:

Name1 Info1 Extra1
Extra2
Extra3
Name2 Info2 Extra4
Extra5

Basically, remove repeating data withing a "set". I know how to do it via SQL (thanks to some help), but not within Excel. Thanks!

EggHeadCafe - Software Developer Portal of Choice
Javascript Debugging Tools for AJAX Developers
http://www.eggheadcafe.com/tutorials...ging-tool.aspx


All times are GMT +1. The time now is 03:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com