Professional Documents
Culture Documents
In Excel language our Nested IF statement would read: = IF(logical_test, value_if_true, IF(logical_test, value_if_true, IF(logical_test, value_if_true, IF(logical_test, value_if_true,.so on and so on up to 64 iterations) Lets translate it into English by applying it to row B of our spreadsheet: =IF(B2=Central, if so enter 3%, if not see if B2=East, and if so enter 4%, if not see if B2=North, and if so enter 5%, if not see if B2=South, and if so enter 6%, if not see if B2=West, and if so enter 7%, if not enter Missing) In Excel it would look like this: =IF(B2=Central, 3%,IF(B2=East, 4%,IF(B2=North, 5%,IF(B2=South, 6%,IF(B2=West, 7%,Missing))))) In the above formula were telling Excel to put 3% in the cell if B2=Central, if not move on to the next IF statement and so on. In the last IF statement, IF(B2=West,7%,Missing), we tell Excel to enter the word Missing in the cell if all previous IFs are false. Alternatively we could instruct Excel to enter 0% or anything else we like in place of Missing. Or, if we left this argument out altogether Excel would enter the word FALSE for us by default. Lets make it better With the formula the way it is wed have to manually update the percentages for each region if we
wanted to alter them. And then copy and paste the revised formula down the column. A better formula would link to the table in columns I & J. Then if we updated the percentages in column J, our formula in column G would dynamically update. If we linked our formula to column J for the percentage rates it would look like this: =IF(B2=Central, $J$2,IF(B2=East, $J$3,IF(B2=North, $J$4,IF(B2=South, $J$5,IF(B2=West, $J$6,Missing))))) If we wanted to change a rate wed simply change the rate in column J and it would dynamically update our formula in column G.
Our spreadsheet is all about the viewing figures for the two main TV channels in the UK. The data is a bit old, but that's not important. As long as we have some nice information to sort, that's what matters. The viewing figures for ITV have been sorted, from the highest first to the lowest last. The BBC1 figures are still waiting to be sorted. Let's see how to do that now.
To sort your BBC 1 viewing figures, do the following: From the Excel tabs at the top of the screen, click Data:
From the Sort & Filter panel, click Sort A dialogue box appears:
The Sort By drop-down list seems empty. Click the down arrow to reveal the columns you selected:
We want to sort this by the values in the Millions column. So select Millions from the Sort by list. Sort On is OK for us - it has Values. But click to see the options in the drop down list:
Values is the one you'll use the most. Once we have a Sort By and Sort On option selected, we can then move on to the Order. Click the down arrow to see the options on the Order list:
Select Largest to Smallest. Your Sort dialogue box should then look like this:
If you clicked OK, your data would be sorted. But the level buttons at the top can come in handy. If two items in your data have the same numbers, then you can specify what to sort by next. For example, if we have two programmes that have 6.3 million viewers, we could specify that the names of the programmes be sorted alphabetically. To do this, click the Add Level button, and you'll see some additional choices appear. You'll see the same lists as the Sort By box. If you select Column A, and then Descending, Excel will do an alphabetical sort if two items have the same viewing figures.
In the image above, we've added a "Then By" part, just in case there is a tie. You don't have to do this, as we have no numbers that are the same. Click OK to sort your data, though. If everything went well, your sorted data should look like this: