Alias Column Names

ijswalker

Registered User.
Local time
Today, 13:58
Joined
Jun 16, 2008
Messages
67
Hi All

I have a query in an excel workbook that references another sheet in the same workbook. The query is fine but when I create a new calculated column within the query I would like to give it a name.

I have tried : for example
PHP:
AS "ColumnName"
and different permutations of this but it always reverts back to expr1013.

Does anyone have any suggestion?

Thanks

Ian
 
I've tried that also but it still doesn't hold the name.
 
Are you sure that the name is unique and not being used already? It will do that if it isn't unique. Also, can you supply your whole SQL statement?
 
I'm probably way off beam here but I couldn't decide whether we are talking Excel or Access. You don't create a new column in Excel as far as I'm aware they are all already there, but one can insert a column, and give the column range a name, the code would be e.g., I think,

Columns("C:C").Select
Selection.Insert Shift:=xlToRight
ActiveWorkbook.Names.Add Name:="Colname", RefersToR1C1:="=Sheet1!C3"


Brian

Of course I'm off beam, you are talking Microsoft Query aren't you? I'll go back to sleep.
 
Last edited:
Hi,

We are talking excel. The columns are already in the worksheet but I am pulling data from a worksheet and want to give the calculated columns a heading name.

Here is the code.

Code:
SELECT `'Cur Bud Data$'`.Concatenate,
 `'Cur Bud Data$'`.Leader,
 `'Cur Bud Data$'`.Cost_Center,
 `'Cur Bud Data$'`.Description,
 `'Cur Bud Data$'`.Type,
 `'Cur Bud Data$'`.Acct_Number,
 `'Cur Bud Data$'`.Acct_Description,
 `'Cur Bud Data$'`.`Actual _2007`,
 `'Cur Bud Data$'`.Actual_2008,
 `'Cur Bud Data$'`.Budget_2009,
 `'Cur Bud Data$'`.Budget_2010,
 `'Cur Bud Data$'`.`YTD Act_2009`,
 `'Cur Bud Data$'`.Budget_2009,
 (`'Cur Bud Data$'`.Budget_2009-`'Cur Bud Data$'`.Actual_2008) , 
((`'Cur Bud Data$'`.Budget_2009-`'Cur Bud Data$'`.Actual_2008))/`'Cur Bud Data$'`.Budget_2009 
FROM 
`C:\Copy of FY09 SVH Detail Budget Review v4`.`'Cur Bud Data$'` `'Cur Bud Data$'`
WHERE 
(`'Cur Bud Data$'`.Cost_Center=8688)

Thanks

Ian
 

Users who are viewing this thread

Back
Top Bottom