- •Solutions for Excel How to accomplish a common task in a fast, flexible and efficient way
- •Create sequential table rows and columns
- •Problem
- •Solution
- •Similar tasks
- •Fill blank range
- •Problem
- •Solution
- •Similar problems
- •Fill table with formulas with row and column inputs
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Convert formula to its results
- •Problem
- •Solution
- •Similar tasks
- •A legible formula
- •Problem
- •Solution
- •Similar tasks
- •A dynamic date range
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Check for a condition
- •Problem
- •Solution
- •Formula syntax
- •Similar problems
- •Select one from a range of options
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Combine data from several data ranges in one
- •Problem
- •Solution
- •Formula syntax
- •Make 1 look as "q1"
- •Problem
- •Solution
- •Similar tasks
- •Problem
- •Solution
- •Similar tasks
- •Sum or count only certain values in a range
- •Problem
- •Solution
- •Formula syntax
- •Find data in a table
- •Problem
- •Solution
- •Formula syntax
- •Create a random password
- •Problem
- •Solution
- •Formula syntax
- •Get data from a cell n columns to the left or right
- •Problem
- •Solution
- •Formula syntax
- •A drop-down list of values
- •Problem
- •Solution
- •Similar tasks
- •Compare positive and negative numbers
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
- •Let formula read address name from an external cell
- •Problem
- •Solution
- •Formula syntax
- •Similar tasks
Similar tasks
To edit names once they are created, use Insert-Name-Define menu command (03) of Name Manager ribbon command (07/10). Name Manager is a convenient interface to edit many names at once. For Excel 2003, you can install an add-in by Jan Karel Pieterse that creates a Name Manager interface.
It is best to follow certain best practices when using names:
Names are great if not overused. If you have a variable that is repeatedly called many times over in a sheet of workbook, this is probably a good name target. If you are referring to a cell just once, better leave it as is.
Names should be brief but descriptive. By looking at a name, you should at least understand what it may mean. Names that are too abstract or too abbreviated will keep confusing you.
Groups of similar names can be identified by a prefix. For example, if you have several lists, you can start all of their names with l_ - e.g. l_units, l_prices and so on. This way, that will stick together in the list and in the Name Manager.
For other operations with names, refer to Define and use names in formulas | Online Office Help from Microsoft.
A dynamic date range
Tools: functions DATE, YEAR, MONTH, DAY, TODAY
Level: intermediate
Problem
You need to make a project timeline with monthly intervals. You do not know, however, when the project will actually start. It may be this month, next month or even next January. Given that your model will be reviewed in many meetings, you will need to update the timeline every time you take it anywhere. Worse, your boss might take it to meetings too, and you cannot rely on her updating the timeline.
How do you make a formula that automatically starts the project timeline from the first day of the month immediately following this month?
Solution
We will use several built-in Excel date and time functions. In particular, we will need TODAY(), YEAR(), MONTH(), DAY() and DATE(). For simplicity's sake, let's also number future monthly periods – 1,2,3,4 and so on and enter them in cells A6 and down column A.
Enter function =TODAY() in cell B1. It requires no arguments and only displays the current date. Excel date is a serial number. Excel considers January 1, 1900, to be day number 1, January 2, 1900 day number 2 and so on. The dates from year 2012 already exceed 40 000.
Enter function =YEAR(B1) in cell B2. YEAR returns the year of a date as number.
Enter function =MONTH(B1) in cell B3. MONTH returns the month of a date as number.
Enter function =DAY(B1) in cell B4. DAY returns the day of a date as number. You have now the today's date properly broken into year, month and day. Every day, these figures will change, as TODAY() function that they refer to will return new value.
Now, let's reconstruct the first of next month from these dynamic variables. Enter function =DATE($B$2,$B$3+A6,1) in cell B6.
Copy cell B6 down column B. You now have a range of cells in column B with future period dates.
|
A |
B |
1 |
Today's date |
=TODAY() |
2 |
Today's year |
=YEAR(B1) |
3 |
Today's month |
=MONTH(B1) |
4 |
Today's day |
=DAY(B1) |
5 |
Period |
Period date |
6 |
1 |
=DATE($B$2,$B$3+A6,1) |
7 |
2 |
=DATE($B$2,$B$3+A7,1) |
8 |
3 |
=DATE($B$2,$B$3+A8,1) |
9 |
4 |
=DATE($B$2,$B$3+A9,1) |
We could have also embedded all the intermediate calculation in the DATE() function; the only reason not to do so is make the formula more understandable at this point.
