(4) ivanlocke (Civil/Environmental)
4 Feb 03 11:17
In excel you can write functions just like you can write a macro.
I don't have excel on this computer, so I can't look up just what it looks like, but it would be something like this:
function dsin(angle as number);
Or something like that.
Look up the help in excel. It is fairly straight forward. You can put it in one of the global module things, so that it doesn't matter what spreadsheet you have open it always has that function available.
You can write functions called dsin, dcos, dtan or whatever. (make sure you don't use function names that are already used).
I have found writing your own functions to be very helpful.
When I was working in a geotech lab we had all our report sheets in excel using macros, but if you went in and changed a number you had to make sure the macro got run, or else all the results were wrong. Macros take a long time, so you couldn't just set cells to run it each time any cell in the spreadsheet ran.
I wrote some functions that calculated USCS classifications from gradations and found proctor maximums from a curve fit and such things. They calculate just like normal excel formulas and are quick and calculate in the background if you are typing a mess of data (instead of waiting or losing typing inbetween cells as things calculate).
Writing functions is also useful for loops and complex equations where it is a pain to reference many cells over and over again.
If you want me to look up what the exact function would look like, let me know and I'll do it sometime when I'm at home (we have corel suite at work for some reason).