We're about to finish for the Whitsun bank holiday weekend here in the UK, and I'm curious how many of you are going to be working over the weekend. Or what would be more interesting is how many of you will actually get a weekend completely free of work (for those of you not in the UK, will you get Saturday and Sunday?). That means not checking work emails - completely switching off from work.
I am aiming to spend some time with the family, maybe get out for a long walk in the middle of nowhere, but I would struggle to not check emails on my phone when I have a signal, and have some work I definitely need to fit in over the weekend.
Please let me know what you are up to in the comments. For those of you who are not even checking emails, maybe you can answer on Tuesday!
If you enjoyed this post, go to the top left corner of the blog, where you can subscribe for regular updates and your free report. If you wish to help me to provide future posts like this, please consider donating using the button in the right hand column.
Search Not Just Numbers
Friday, 27 May 2011
Friday, 20 May 2011
EXCEL TIP: The dollar sign ($) in a formula - Fixing cell references
I want to cover something today that I use all of the time but seems to be understood in varying degrees by clients I work with.
I am talking about use of the dollar sign ($) in an Excel formula.
Relative cell references
When you copy and paste an Excel formula from one cell to another, the cell references change, relative to the new position:
EXAMPLE:
If we have the very simple formula "=A1" in cell B1 it will change as follows when copied and pasted:
Pasted to B2, it becomes "=A2"
Pasted to C2, it becomes "=B2"
Pasted to A2, it returns an error!
In each case it is changing the reference to refer to the cell one to the left on the same row as the cell that the formula is in, i.e. the same relative position that A1 was to the original formula.
The reason an error is returned when it is pasted into column A, is because there are no columns to the left of column A.
This behaviour is very useful and is what allows a sum to be copied across or down the page and automatically refer to the new column or row that it finds itself in.
But in some situations, you want some or all of the references to remain fixed when they are copied elsewhere.
The dollar sign ($)
This is where the dollar sign is used.
EXAMPLE:
Take an example where you have a column of Sales values in Pounds Sterling in column A and a formula to convert these into US Dollars in column B. You could enter the actual exchange rate into the formula but it would be more sensible to refer to a cell where the exchange rate is held, so that it can be updated whenever it is needed.
The simple formula for cell B2, would be "=A2*E1", however if you copy this down, then the formula in cell B3, would read "=A3*E2" as both references would move down a row as described above.
This is where the dollar sign ($) is used. The dollar sign allows you to fix either the row, the column or both on any cell reference, by preceding the column or row with the dollar sign. In our example if we replace the formula in cell B2 with "=A2*$E$1", then both the "E" and the "1" will remain fixed when the formula is copied. i.e. in cell B3, the formula will read "=A3*$E$1", still referring to the cell with the exchange rate in it.
In this example we have fixed both the row and the column, but in other situations, you may just want to fix one or the other, for example:
Above we have a spreadsheet calculating the times tables where we want to every cell in the white area to be the product of its row and column heading. This is easy using the dollar symbol. In cell B2, the formula without dollars would be "=A2*B1", but for this formula to work when copied to each column, we need it to always look at column A for the first reference and to work for each row, we need to always look at row 1 for the second. Using the dollar sign to do this, it becomes "=$A2*B$1". This can then be copied to every cell in the white area.
Quick Tip
You can speed up entering the dollar signs by using the function key F4 when editing the formula, if the cursor is on a cell reference in the formula, repeatedly hitting the F4 key, toggles between no dollar signs, both dollar signs, just the row and just the column.
If you enjoyed this post, go to the top of the blog, where you can subscribe for regular updates and get your free report "The 5 Excel features that you NEED to know".
I am talking about use of the dollar sign ($) in an Excel formula.
Relative cell references
When you copy and paste an Excel formula from one cell to another, the cell references change, relative to the new position:
EXAMPLE:
If we have the very simple formula "=A1" in cell B1 it will change as follows when copied and pasted:
Pasted to B2, it becomes "=A2"
Pasted to C2, it becomes "=B2"
Pasted to A2, it returns an error!
In each case it is changing the reference to refer to the cell one to the left on the same row as the cell that the formula is in, i.e. the same relative position that A1 was to the original formula.
The reason an error is returned when it is pasted into column A, is because there are no columns to the left of column A.
This behaviour is very useful and is what allows a sum to be copied across or down the page and automatically refer to the new column or row that it finds itself in.
But in some situations, you want some or all of the references to remain fixed when they are copied elsewhere.
The dollar sign ($)
This is where the dollar sign is used.
EXAMPLE:
Take an example where you have a column of Sales values in Pounds Sterling in column A and a formula to convert these into US Dollars in column B. You could enter the actual exchange rate into the formula but it would be more sensible to refer to a cell where the exchange rate is held, so that it can be updated whenever it is needed.
The simple formula for cell B2, would be "=A2*E1", however if you copy this down, then the formula in cell B3, would read "=A3*E2" as both references would move down a row as described above.
This is where the dollar sign ($) is used. The dollar sign allows you to fix either the row, the column or both on any cell reference, by preceding the column or row with the dollar sign. In our example if we replace the formula in cell B2 with "=A2*$E$1", then both the "E" and the "1" will remain fixed when the formula is copied. i.e. in cell B3, the formula will read "=A3*$E$1", still referring to the cell with the exchange rate in it.
In this example we have fixed both the row and the column, but in other situations, you may just want to fix one or the other, for example:
Above we have a spreadsheet calculating the times tables where we want to every cell in the white area to be the product of its row and column heading. This is easy using the dollar symbol. In cell B2, the formula without dollars would be "=A2*B1", but for this formula to work when copied to each column, we need it to always look at column A for the first reference and to work for each row, we need to always look at row 1 for the second. Using the dollar sign to do this, it becomes "=$A2*B$1". This can then be copied to every cell in the white area.
Quick Tip
You can speed up entering the dollar signs by using the function key F4 when editing the formula, if the cursor is on a cell reference in the formula, repeatedly hitting the F4 key, toggles between no dollar signs, both dollar signs, just the row and just the column.
If you enjoyed this post, go to the top of the blog, where you can subscribe for regular updates and get your free report "The 5 Excel features that you NEED to know".
A New Era for Not Just Numbers
Sunrise over Seaham |
Not Just Numbers was originally intended to generate traffic for my other businesses, however it is difficult to justify the effort required purely on this basis - hence the deliberations over the last couple of months.
I have been wrestling with this because I enjoy doing the blog and would hate to give it up, and there are many intangible benefits which are difficult to measure for both the business (additional credibility for clients brought in through other routes for example) and for me personally (communicating with many interesting readers that I would not have otherwise met).
Well, the deliberation is over and I have decided not only to continue, but step up the blog activity, while looking for additional ways in which the blog can contribute financially (I still have a business to run!). The most immediate change you will see is the donation button in the right hand column, but I will also be looking for additional advertising where appropriate.
So, onwards and upwards.
PS: Not Just Numbers posts are like buses, none for two months then you get two in one day - there will be another post later today about using the dollar sign in Excel formula to fix cell references.
If you enjoyed this post, go to the top left corner of the blog, where you can subscribe for regular updates and your free report. If you wish to help me to provide future posts like this, please consider donating using the button in the right hand column.
Subscribe to:
Posts (Atom)