12.07.2015 Views

Excel Add-in Development in C/C++: Applications in ... - F9

Excel Add-in Development in C/C++: Applications in ... - F9

Excel Add-in Development in C/C++: Applications in ... - F9

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24 <strong>Excel</strong> <strong>Add</strong>-<strong>in</strong> <strong>Development</strong> <strong>in</strong> C/<strong>C++</strong>The dialog that appears is shown <strong>in</strong> Figure 2.2.Figure 2.2<strong>Excel</strong>’s Solver add-<strong>in</strong> dialogThis is a far more flexible solver, capable of solv<strong>in</strong>g for a number of <strong>in</strong>puts to get to thedesired s<strong>in</strong>gle cell value, maximum or m<strong>in</strong>imum. The user can also set constra<strong>in</strong>ts to avoidunwanted solutions and options that dictate the behaviour of the algorithm. Section 10.12Calibration, on page 381, talks more about this very powerful tool.The complexities govern<strong>in</strong>g when solutions converge, when they are unlikely to, whenthere may be multiple solutions, and to which one you are most likely to converge, arebeyond the scope of this book. (<strong>Excel</strong> provides help for the solver via the Tools/Solver...dialog’s Help button.) If you <strong>in</strong>tend to rely on a solver for someth<strong>in</strong>g important you eitherneed to know that your function is very well behaved or that you understand its behaviourwell enough to know when it will be reliable.2.11 EXCEL RECALCULATION LOGICThe first th<strong>in</strong>g to say on this often very subtle and complex subject is that there is muchmore that can be said than is said here. This section attempts to provide some basic <strong>in</strong>sightand a foundation for further read<strong>in</strong>g.<strong>Excel</strong> recalculates by creat<strong>in</strong>g lists of cells which determ<strong>in</strong>e the order <strong>in</strong> which th<strong>in</strong>gsshould be calculated. <strong>Excel</strong> constructs this by <strong>in</strong>spect<strong>in</strong>g the formulae <strong>in</strong> cells to determ<strong>in</strong>etheir precedents, establish<strong>in</strong>g precedent/dependent relationships for all cells. Onceconstructed, cells <strong>in</strong> the lists thus generated are marked for recalculation whenever aprecedent cell has either changed or has itself been marked for recalculation. Once thisis done <strong>Excel</strong> recalculates these cells <strong>in</strong> the order determ<strong>in</strong>ed by the list.After an edit to one or more formulae, lists may need to be reconstructed. However,most of the time edits are made to static cells that do not conta<strong>in</strong> formulae and are nottherefore dependent on anyth<strong>in</strong>g. This means that <strong>Excel</strong> does not usually have to do thiswork whenever there is new <strong>in</strong>put.As this section shows, this system is not <strong>in</strong>fallible. Care must be taken <strong>in</strong> certa<strong>in</strong> circumstances,and certa<strong>in</strong> practices should be avoided altogether. (VB code and spreadsheet

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!