Calc2Code Tips of the Day

Day 2

Today's first tip shows you how to use Calc2Code to create a two dimensional table in Excel to perform what-if analysis. the spreadsheet profit.xls contains a spreadsheet which calculates the profit for a business. The revenues are driven by the price of the company's single item, and the expenses are a funcion of the number of workers employed. Although it is a rather simple model, it's difficult to do all the math in your head, and a spreadsheet is a great way to calculate the profit and try to make sure the price and employees are chosen wisely.

Here's the spreadsheet profit.xls:

profit1

The demand goes up as the price goes down, and the number of units sold is the lower of the demand, and the number of units produced (which is itself a function of the number of workers).

Seeing how the profit changes as the price and the number of workers changes can be done inside this spreadsheet by changing C3 and C6 over and over again, but this is tedious. instead, we will use Calc2Code to turn all the calculations into a single function. This is how to set it up in the configuration screen:

profit3

There are two drivers to the function, C3 and C6,and the profit is in C18. We close this, push the builder button, and a few moments later we have a function called Profit.

Now, we can create proft2.xls and use this function to quickly build a table that demonstrates the relationship between profits, prices and staffing:

profit2

Of course, we could use Solver to find the optimal combination that maximizes profit, but the table gives us a better feel for how much each worker is worth or whether changing the price a little makes a big difference.

Taken together with yesterday's tips, we can see a theme emerging: Calc2Code enhances Excel by encapsulating the logic of multiple cell calculations into a single formula. And as we saw with the commission examle yestersay, even long single cell formulas can be helped by Calc2Code since breaking them up into many smaller formulas leads to fewer errors and faster development and testing.

Our next tip demonstrates a different aspect of Calc2Code. Click here to view it.

 

GET A FREE TRIAL OF CALC2CODE NOW

Fields with an asterisk are required.
First Name:

Last Name:
Company:
*Email (free trial will be sent here, we NEVER share it):
 

"Once you’ve used Calc2Code, you may find that you simply can’t be without it."

Rick Grehan, InfoWorld

"It's not just cool. It's simple."

Tom Yager, InfoWorld

"With Calc2Code, I'm able to write sophisticated C++ programs in minutes using only an Excel spreadsheet. Doing it directly in C++ would take several days."

Jerome Montpetit, Risk Manager, Canadian Financial Institution

"A highly specialized tool that can bring significant benefits to some development tasks."

Peter Aitken, DevSource

"Calc2Code does just one thing: converts Excel spreadsheets and VBA to C++ DLLs and addins. But the implications of this, and it's myriad uses, are much more far-reaching in terms of latency reduction and productivity enhancement."

Andy Webb, e-FOREX

     
  Copyright 2004-2021, Options Unlimited Research Corp.