ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   group pivot table from external source (https://www.excelbanter.com/excel-programming/314391-group-pivot-table-external-source.html)

scottwilsonx[_60_]

group pivot table from external source
 

Hi everyone, I have an excel pivot-table whose source is an external SQ
server.
I have pulled across all the rows I want, however I want to create
new field that groups the "names" variable.

Is there a way to create a lookup or something in VBA that will grou
the names automatically everytime the data is refreshed?

Thanks for your help.

Scott

--
scottwilson
-----------------------------------------------------------------------
scottwilsonx's Profile: http://www.excelforum.com/member.php...fo&userid=1112
View this thread: http://www.excelforum.com/showthread.php?threadid=27152


Jamie Collins

group pivot table from external source
 
scottwilsonx wrote ...

Hi everyone, I have an excel pivot-table whose source is an external SQL
server.
I have pulled across all the rows I want, however I want to create a
new field that groups the "names" variable.


I'm assuming you have a column named "names" (consider renaming
because NAMES is vague and a reserved word for future use in SQL
Server).

If you have control over the sql, you could simply make [names] the
first column in your ORDER BY clause e.g.

SELECT
MyKeyCol, MyTextCol, Names
FROM
MyTable
ORDER BY Names, MyTextCol
;

If you do not have control over the sql (e.g. you only have
permissions to run a stored procedure) you could use an ADO recordset
and sort by [names] on the client side.

Post some more details e.g. sql code, example data, required
groupings, etc.

Jamie.

--


All times are GMT +1. The time now is 07:47 AM.

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