Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Calculations Return by SQL

Hi All,

Is it possible to return a custom calculation from SQL into a cell and
make it work? For example, I have columns A, B, C, D. I will return
values for A,B,and C, but for D I will return =A1+B1.

A B C D
1 2 3 3
2 2 8 4

In another scenario, D may be B + C

A B C D
1 2 3 5
2 2 8 10

I would like to make this dynamic enough where I would have to only
change the SQL vs changing the Excel Spreadsheet (distributing new one
everytime a calculation is changed). Right now, it returns the
following:
A B C D
1 2 3 =A1+B1
2 2 8 =A2+B2

The strange thing is that when I go into the cell, hit F2, then enter
it correctly calculates. I have tried using Application.CalculateFull
in VBA and also Ctrl + Alt + F9 in the worksheet itself, but both
methods don't seem to work.

TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calculations Return by SQL

Sounds like your cells are formatted as Text. Try formatting them as
general - then to convert the existing formulas, select column D, do
Edit=Replace
What =
With =

This will cause excel to reevaluate the entries and treat them as formulas.

--
Regards,
Tom Ogilvy

"CST" wrote in message
om...
Hi All,

Is it possible to return a custom calculation from SQL into a cell and
make it work? For example, I have columns A, B, C, D. I will return
values for A,B,and C, but for D I will return =A1+B1.

A B C D
1 2 3 3
2 2 8 4

In another scenario, D may be B + C

A B C D
1 2 3 5
2 2 8 10

I would like to make this dynamic enough where I would have to only
change the SQL vs changing the Excel Spreadsheet (distributing new one
everytime a calculation is changed). Right now, it returns the
following:
A B C D
1 2 3 =A1+B1
2 2 8 =A2+B2

The strange thing is that when I go into the cell, hit F2, then enter
it correctly calculates. I have tried using Application.CalculateFull
in VBA and also Ctrl + Alt + F9 in the worksheet itself, but both
methods don't seem to work.

TIA



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Calculations Return by SQL

Hello Tom,

I don't think that it was a formatting issue, but the edit- replace
seems to have tricked Excel into re-evaluating the formulas. I think
that you have helped me out in the past and wanted to again thank you
for the help in the past and now.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return date if in range, else return blank LisaL Excel Worksheet Functions 1 July 22nd 09 03:23 PM
Compare Value in Cell 1 to a List, Return Value if Match otherwise Return Null Ben Excel Discussion (Misc queries) 2 March 15th 07 01:02 AM
LOOKUP and return the column heading for IF/THEN return for False NN Excel Discussion (Misc queries) 1 October 6th 06 11:24 AM
check if reference exists, then return its value or return 0 doudou Excel Worksheet Functions 1 June 4th 05 09:17 PM
VBA Syntax for VLOOKUP to return array of return values Alan Beban[_3_] Excel Programming 7 August 5th 03 11:41 AM


All times are GMT +1. The time now is 01:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"