I do a lot with spreadsheets. And when I work in spreadsheets I work in OpenOffice. Most people know the ins and outs of spreadsheets, but many don't realize just how powerful spreadsheets can be. Openoffice Calc holds a lot more bang for the users' buck than you might think. For instance, did you know that Calc can do If/Else statements? In this spreadsheet tutorial you will learn how to use IF/ELSE statements in OpenOffice Calc.
Let's say you have two columns of numbers and you want to add a third column based on the other two data. That third columns' entry will depend upon the information in the first two. IF entry A is greater than B THEN C is X ELSE C is Y.
But how does one do this? It's actually quite easy. Let's start out with a more simple example and move on to a more complex example.
The first example will illustrate a basic IF/ELSE statement that uses only two columns of data. We'll do a simple spreadsheet that deals with how many persons each employee will bring to a company picnic. To make things easy if the person enters "0" that means they are not bringing a guest (the employee, however, IS required to come) and if they enter "1" that means they are which means that employee equals two attendees. The first column will represent the name of the employee and the second column is how many guests the employee will bring. The formula to enter into the third column would look like:
What this will do is enter a "2" in the third cell is the employee is bringing a guest and a 1 if they are not.
Now let's make this a bit more complex. For this example we'll have three columns. The first column is a number that represents how many hours an employee worked. The second column will represent how many hours over 40 they worked. The third column will represent how much overtime pay they made. But let's say you also have to account for zero hours worked. The formula for the second column would look like this:
For the third column let's continue with this idea. Say if an employee worked over 5 hours of overtime they would gain an extra 100 dollar bonus in their check. So we'll add a fourth column for bonuses. For simplicity's sake all employees make $10.00 an hour. Overtime is standard time and a half pay. So the forumla for the third column would be a standard:
And the formula for the fourth column would be:
Now for the final total for employee salary a fifth column would be added that would look like:
The examples may be very simple but the idea can be applied to many instances. Using IF/ElSE statements in OpenOffice Calc can quickly take your spreadsheets to a much higher level of usability.
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.