group pivot table from external source

  • Thread starter Thread starter scottwilsonx
  • Start date Start date
S

scottwilsonx

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
 
scottwilsonx said:
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.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top