![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Using the SUMIF Function to Prepare a Profit & Loss Account The SUMIF function has been with us in spreadsheeting terms for a long time now. This page will reveal it, however, to have a level of usefulness that may have remained an mystery until now! This page demonstrates how a simple built in function can help us to turn our data into information in the twinkling of an eye! You can use our new file Derive a Trial Balance using a Pivot Table in Excel in conjunction with this page: the link is on the left This table shows the before and after of our situation: from raw data to information
Note: There are many more transactions: these are just examples How do we do this? The SUMIF function has the following characteristics: =SUMIF(range,criteria,[sum_range]) We use this SUMIF function to add together all values that conform to a criterion. For example, from the table above, we used SUMIF to add together all the sales values, all of the purchase values and so on. What we do is instruct Excel, for example, to look in a range and find every case where the word "sale" occurs; once we have done that, find the value of each incidence of "sale" and add them all together. Let's use the table above to demonstrate what this means. Imagine the table above begins in Cell A1, we apply the SUMIF function to find the total value of Sales as follows. In cell G2 we enter =SUMIF(A2:A122,"Sales",B2:B122) Note: the complete list of transactions extends down to row 122, even though we have only shown them down to row 22 in the table above). Once we press We do the same for every element of the Profit & Loss Account:
Opening stock
Here are the SUMIF statements for the first Opening stock and Purchases
For the Opening Stock, enter this in cell F4 =SUMIF(A2:A122,"Opening Stock",B2:B122)
For the Purchases, enter this in cell F5 =SUMIF(A2:A122,"Purchases",B2:B122)
For you to do
Now you can generate the SUMIF functions you need to complete the Profit & Loss Account layout.
If you would like a copy of my spreadsheet to help you to check this, just write to me at the email address you can find at the bottom of this page.
Making the Example More Flexible
Take a look at the following:
=SUMIF(A:A,"Sales",B:B)
This function allows us do exactly what we have done before but this time, we can add to the list of transactions in Columns A and B without needing to change the function. If we didn't make this change and wanted, say to add eight more transactions, we would need to enter
=SUMIF(A2:A130,"Sales",B2:B130)
Then if we wanted to add another ten transactions, we would have to change this function, AND all others to
=SUMIF(A2:A140,"Sales",B2:B140)
Similarly,
=SUMIF(A:A,"Opening Stock",B:B)
Extending the Model
We can extend this model in at least two ways:
Balance Sheet: whilst it isn't shown here, anyone who needs to and knows the layout needed, can use the ideas shown in this example to generate data that can be used to draft a balance sheet in exactly the same was as we have done for the profit & loss account.
Random Numbers: we can use random numbers to help us to generate new questions … we are thinking here of teachers, trainers and examiners who might need to generate a number of similar questions: this is how this part works and by the way, our own spreadsheet uses this function too.
The beauty of using this approach is that each time we press the In cell A3 we have =RANDBETWEEN(1800,2300)
This means that Excel will generate a random number from 1800 to 2300 inclusive when All Sales transactions have this function in column B
All Purchase transactions have =RANDBETWEEN(900,1100)
and so on; but note that items such as Opening Stock and Closing Stock only need one entry in a simple example like this and you could enter a value for them rather than a RENDBETWEEN value but make sure to change this value if you make your RANDBETWEEN values much larger than we have seen here otherwise the stock values will be unrealistic.
In fact, we can set these values at any level: sales could be from 100 to 105 or 100000 to 5000000; purchases could be from 3000 to 4500 or from 675000 to 1000000
Choose the values you wish: for young students or for people new to accounting, keep the numbers small!
Vital Information
We need to know that =RANDBETWEEN does not work automatically, although it might be installed on your computer. If it is not installed you will face the #NAME! error when you try to use it.
In order to use =RANDBETWEEN, do the following:
Tools
It should work now although some of you may be asked to install the CD with the Excel software on it.
Note: there is also the Analysis ToolPak - VBA option in the Add-Ins selection … you don't need to tick this.
Conclusions
The SUMIF function can be a very useful function and we have demonstrated here one of the ways in which we can use it, to help us to manipulate data in such a way that we turn data into information.
This page has also combined SUMIF with RANDBETWEEN in a way that teachers, trainers and examiners might appreciate: by helping them to generate many versions of the same question.
What the Spreadsheet Might Look Like Now
In full, then, the top part of our spreadsheet looks like this:
Duncan Williamson
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
© Webmaster Duncan Williamson 2002 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||