Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Need assistance with Excel formula to SQL

Author  Topic 

Visual Studio Guy
Starting Member

2 Posts

Posted - 2009-05-04 : 16:11:00
Hello,

New to the forum and Visual Studio I really enjoy working with it..but my mind set is still in excel and access mode.

I have a multiple IF statment in excel that works like a charm but when i try and take statement logic to visual studio its not working.

I have attached the logic from my excel formula and anyone who can help me with the right commands it would be GREATLY apprecated.

I basically have a sequl report that exports data.. i then export to excel and put the following forumula in my last cell to get the calculation i need. This worked for my purpose but i have now been called on to have this report autodelivered and adding my forumaul after excel export will not suffice i need it to calcualte in Visual Studio.

So here goes..

Excel Formula

IF(Last Receipt<(Units_30-360) , IF(units_oh>units_360, IF(units_360>0,(units_oh-units_360)*(extended_Vaule/Units_oh), Extended Vaule),0),0)

Good one huh! :o)

Many thanks in advance if ya can help me out...

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-05-04 : 16:32:25
use a case statement maybe?

What exactly are you trying to do in that god awful IF statement :)

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

Visual Studio Guy
Starting Member

2 Posts

Posted - 2009-05-04 : 17:07:52
HAHA I started off with a good one huh.. :)

Its tough to explain but basically I am taking items we have on hand and factoring in what was sold over the past 30 60 90 180+ days and pulling in the data to show a $ value.

So i have the SQL report run its calcs based on those fields and then i would take the excel export and throw that formula in the last cell so i would get my number.
I bascailly just need to convert it..SOMEHOW LOL


quote:
Originally posted by yosiasz

use a case statement maybe?

What exactly are you trying to do in that god awful IF statement :)

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion

Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-05-04 : 18:11:23
aha a sort of 30 day moving average? is that it ?

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-05-04 : 18:12:49
what you might be looking for is

http://oreilly.com/catalog/transqlcook/chapter/ch08.html


<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -