Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Need to write a GoalSeek function in C#

Posted on 2004-10-27
3
Medium Priority
?
2,098 Views
Last Modified: 2007-12-19
Hello,

I am in the process of moving over an Excel spreasheet with macros in it to a web application.  All is well, except for this one cell which contains within it a GOALSEEK function. I have no idea what the algorithm is to replicate this function, or if I can import some DLL to simply access it... Help!

Thanks in advance,

Julie

Range("E31").GoalSeek Goal:=0, ChangingCell:=Range("D31")
0
Comment
Question by:anoukmercier
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
Razzie_ earned 750 total points
ID: 12424996
The Goalseek function takes an input parameter and a target ouput, and will change a variable so that using a specific mathematical aloghritm, the target output is reached, and will return the value of the changing variable. (what a lousy sentence :)

If you'll always do the same mathematical aloghritm, for example finding the correct rate for a monthly payment, you might want to write that function yourself? Depending on how complex it is, it might be easier then importing Excel functions (I have no idea how that works).

Cheers,

Razzie
0
 

Author Comment

by:anoukmercier
ID: 12425788
You're right... I was hoping for some sort of magic formula, I guess, but I finally rolled up my sleeves to try and figure out what the heck was happening in the background, and once I figured out what that function did, I was able to replicate some code (had to create a while loop to iterate through the target value, and re-calculate all functions).

Thanks,

Julie
0
 
LVL 8

Expert Comment

by:Razzie_
ID: 12428155
Glad you figured it out :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question