More Excel



IF formulas in Excel

A very important formula that allows one to "make decisions about data is the if statement. It works by evaluating if a statement is true, if it is then it returns certain result, such as a number or statement, otherwise (if it is false) it returns a different result. The syntax is basically, IF(evaluation, true, false).



Iterations in Excel

We will demostrate the use of iterations in Excel.  This method allows you to either move a calculation toward a solution by "narrowing in" on a solution or, as we commonly use it in geological modeling, to simulate the passage of time with "time steps." For example, 1-D of diffusion of ions in a solution, or draw down of an unconfined aquifer due to pumping of a well.

To use iterations successfully, you must
1.  have equations that refer to each other in a "circular argument."
2.  Turn off the "automatic calculation" that solves all the equations on a page as you change them.
    we do this selecting the Tools Menus/ Options..... from the menu at the top, and then clicking on the "calculation" to get this page.

Choose the  "manual" option and then check the "Iteration" box, and put 1 or 10 in the maximum iterations box.  By pressing the F9 key, you will automatically run through the 1 or 10 iterations.



Macros in Excel

Macros are programs within programs that can complete automated tasks.  In Excel, they are written in visual basic, but you really don't need to write them because Excel can "watch" you run through a sample and then write the program from your actions.

Marcros are stored in an Excel "workbook" which consists of pages of spreadsheets and charts, plus additional programmingn like macros.  So when you save the workboook, you also save the macro.  You can also save them separately.

To make a macro choose  Tools/Macro/Record New Macro... from the menu at the top of Excel.

Give it a good name.  Put a letter in the "shortcut key" box if you'd like to the macro from the keyboard via one keystroke (don't use the common letters for other functions like C, S, X, V, ).

Everything you now do, until you hit the stop button, will be watched and recorded.  To have the computer use relative addresses ("move the cursor one cell down", instead of "select A3" ) simply click on the bottom left corner of the recorder box as shown here (well....minus the arrow....its the little picture below the word "Rec")


When you're done, hit the blue square.



David Harbor October 1999, Revised by Connors, 02, 07