Monday, November 3, 2014

Microsoft Excel Functions

How to Provide Ranking ???

In this figure, products B & D are tied with sales of 87. The old RANK and RANK.EQ functions assign both of those products a rank of 2 and no product is ranked as 3.

Statisticians argue that products B & D should each receive a rank of 2.5, since the average of ranks 2 & 3 is 2.5. The new Excel 2010 function RANK.AVG will handle ties in this fashion.

Excel tricksters who use RANK to sort with a formula as described in the next topic want to make sure that every rank is used exactly once. They will use the formula shown in column G. This formula uses the original RANK function and then adds 1 if the ranked value is appearing a second time in the list.


=RANK($B2,$B$2:$B$8)+COUNTIF(B$2:B2,B2)-1
Courtesy By MrExcel.com

Excel FLOOR Function and CEILING Function


Excel has many great functions to allow you to round numbers but FLOOR and CEILING are two pretty cool ones.

While most functions allow you to round to a certain decimal place, these functions allow you to pick what you want to round to. If you need to round to large numbers like the nearest 100 or nearest 500, these functions can do it.

Let’s say we have these numbers below. We want to round the numbers in Column A to the nearest number in column B.


In row 2, we want to round 111 to the nearest 10.  What the FLOOR function will do is round it DOWN to the nearest 10.  The CEILING functions will round it UP to the nearest 10.

So the function would be:


We could also manually type the numbers in and use =FLOOR(111,10) and get the same result.  But references work just as well.

See how Excel takes 111 and rounds it down to the nearest 10 which is 110.

For the CEILING function we would use:

This works similar as FLOOR, except it rounds the number UP to the nearest 10 in this case.  So we get 120.

This will work to round for any instance.  You can round the the nearest 50, or 100 or 372.  It is up to you!  See below for our final results:

Courtesy By Joe.

REPLACE Function in Excel

REPLACE function in excel replaces a set of characters in a text string with a different set of characters, based on the number of characters specified.
At times, imported or copied data in an Excel spreadsheet carries unwanted characters or words, which can be replaced with good data using REPLACE function.
REPLACE function makes it easy to quickly rectify large amount of data. The function can be created for the first entry and then copied to all other cells, as done for most Excel functions.

REPLACE Function Example

Area code updation in phone number
REPLACE function can be used to update the first three digits in a phone number, on area code undergoing a change. In this example, Column C contains the new area code, Column D has the revised phone numbers.


REPLACE Function Syntax
The syntax for the REPLACE function is:
=REPLACE(old_text, start_num, num_chars, new_text)
Old_text – Text where some characters needs to be replaced. This can be a cell reference to the text.
Start_num - Mentions the start position (left to right) of the characters in old_text that needs to be replaced.
Num_chars - Mentions the number of characters to be replaced from the Start_num specified above.
New_text  – Text that will replace characters in old_text. This should be left blank if just unwanted characters need to be removed.
Text values that CONVERT Function accepts
Listed below are text values that CONVERT Function accepts for from_unit and to_unit (in quotation marks) :

WEIGHT AND MASSFROM_UNIT / TO_UNIT
Gram“g”
Slug“sg”
Pound mass (avoirdupois)“lbm”
U (atomic mass unit)“u”
Ounce mass (avoirdupois)“ozm”
TIME
FROM_UNIT / TO_UNIT
Year“yr”
Day“day”
Hour“hr”
Minute“mn”
Second“sec”
DISTANCE
FROM_UNIT / TO_UNIT
Meter“m”
Kilometer“km”
Statute mile“mi”
Nautical mile“Nmi”
Inch“in”
Foot“ft”
Yard“yd”
Angstrom“ang”
Pica“pica”
FORCE
FROM_UNIT / TO_UNIT
Newton“N”
Dyne“dyn” (or “dy”)
Pound force“lbf”
TEMPERATURE
FROM_UNIT / TO_UNIT
Degree Celsius“C” or “cel”
Degree Fahrenheit“F” or “fah”
Kelvin“K” or “kel”
LIQUID MEASURE
FROM_UNIT / TO_UNIT
Teaspoon“tsp”
Tablespoon“tbs”
Fluid ounce“oz”
Cup“cup”
U.S. pint“pt” or “us_pt”
U.K. pint“uk_pt”
Quart“qt”
Gallon“gal”
Liter“l” or “lt”
PRESSURE
FROM_UNIT / TO_UNIT
Pascal“Pa” or “p”
Atmosphere“atm” or “at”
mm of Mercury“mmHg”
ENERGY
FROM_UNIT / TO_UNIT
Joule“J”
Erg“e”
Thermodynamic calorie“c”
IT calorie“cal”
Electron volt“eV” or “ev”
Horsepower-hour“HPh” or “hh”
Watt-hour“Wh” or “wh”
Foot-pound“flb”
BTU“BTU” or “btu”
POWER
FROM_UNIT / TO_UNIT
Horsepower“HP” or “h”
Watt“W” or “w”
MAGNETISM
FROM_UNIT / TO_UNIT
Tesla“T”
Gauss“ga”
CONVERT Function is used to convert data from one measurement unit to another.
For example, converting time from hours to minutes, distance from miles to kilometers, temperature from degrees Celsius to degrees Fahrenheit etc.

CONVERT Function Example

In this example, we’ll be converting table values from hours to minutes


=CONVERT(B3, “hr”, “mn”)
  • Number      :   B3  ( Cell reference for the number to be converted)
  • From_unit   :  “hr”  (Converted from unit – hours)
  • To_unit       :  “mn” (Converted to unit – minutes)
CONVERT function result : 600 in cell C3

CONVERT Function Syntax

=CONVERT(number, from_unit, to_unit)
Number :   The value to be converted.
From_unit :   The measurement unit for Number.
To_unit :   The measurement unit for the converted value (result).

Value Function

Excel mixes up data types at times and sees numerical data as text data. For eg. when you import data into Excel from another program / internet.

In such a situation, functions like SUM or AVERAGE lead to calculation errors.

VALUE Function converts numbers seen as Text to Values and make them function normally for SUM, AVERAGE and other numerical functions.

The syntax for the VALUE function is: = VALUE ( Text )

Text – Data to be converted. It can be actual data in quotation marks or a cell reference.

FIXED Function in Excel

Excel FIXED function returns number rounded to a specified number of decimal places as text. It uses commas as per specification.

SYNTAX

The syntax for the Microsoft Excel FIXED function is:

FIXED( number, [decimal_places], [no_commas] )

number is the number which has to be rounded.

decimal_places is optional. If ithis parameter is omitted, decimal places is assumed to be 2.

no_commas is optional. If set to TRUE, the result will not display commas. If set to FALSE, it will display commas in the result. If omitted, the result will display commas.

REPT Function in Excel

REPT(text, number_times) : Repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.

Text - The text you want to repeat.
Number_times - The number of times to repeat text.



TRIM Function in Excel

TRIM(text) : Removes all spaces from a text string except for single spaces between words

Non Single Spaces




Courtesy By Systemfunda.com

Monday, August 25, 2014

Data Validation Tips

Data Validation a tool , through which Duplication of work can be avoided , Human errors can be minimised and TAT can be saved. There are many more rules. here a glimpse of the same.

Introduction: How do I set a maximum number for the cell?

1. Highlight the area you want to apply data validation to
2. You can highlight the entire column or click in the top cell, press Ctrl + Shift + Arrow down just to select pre-existing data.
3. Click on Data – Data Validation
4. On the Settings tab, choose Whole Number
5. Choose Less than or Less than or Equal to from the dropdown.
6. Enter the value e.g. 20 or if it’s a cell, click on the cell that contains the value you want to use as the maximum.
7. To help the users, it can be useful to add a message
8. Click on Input Message
9. In the Input Message box, type something like “number must be less than 20”
10. And if they persist….
11. Click on the Error Alert tab and in the Error Message box, you could type something like “what part of “enter a number less than 20 did you not understand?”

How do I only allow values between certain amounts ?

1. Follow steps 1-4 above
2. Choose Between from the dropdown
3. Enter your maximum and minimum values.
4. Apply the Input Message and Error Message as above if required. (Steps 7-11 from above)

How do I extend the data validation?

So your data validation is working well but now you find you need to extend it.
1. Highlight where you want to extend it to.
2. Make sure you have included cells with the data validation
3. Click on Data – Data Validation
4. You will receive a message that says “ The selection contains some cells without Data Validation settings. Do you want to extend Data Validation to these cells?”
5. Click on Yes
6. Your data validation dialog box will open up
7. Click OK.

How do I copy the data validation to another part of the sheet?

1. Click on cells with data validation
2. Click on Copy
3. Highlight the cells you want to copy the validation to.
4. Click on Paste – Paste Special.
5. Choose Validation
6. Now test.

How do I stop people changing some entries?

The most straightforward way to do that is by cell protection. But it’s not intuitive. The idea is that you indicate the areas you want people to be able to change and lock down everything else.
1. Begin by highlighting the areas you WANT people to be able to change.
2. Click Ctrl and 1 (to open the Formal Cells dialog box)
3. Click on the Protection tab
4. Clear the Locked box
5. Go to Review – Protect Sheet
6. Choose what you want people to be able to do.
7. Enter your password
8. You will then be prompted to re-enter it.

How do I only allow items from a specific list in?

The clue is in the name…you will be using a list

Method 1 – Create your list - static

1. Use this method if the items in your list will not be changing e.g. months, days etc.
2. On a separate worksheet, create the entries. (Type them vertically)
3. It can be useful to put your list entries on this sheet and call this sheet Lists
4. Highlight your list
5. In the Name Box (to left of formula bar) enter the name you want to give this range.
6. Note no spaces allowed in this name e.g. week_days NOT week days
7. Press Enter
8. Return to the sheet you want to apply the data validation to
9. Follow steps 1-3 in Introduction
10. Choose List from the list
11. Click in the Source box
12. Press F3 to call up your list of range names
13. Click on week_days
14. Now you will have a dropdown box where you can pick the week days from
15. Apply steps 7-11 from the Introduction if you want to add an error message.

Method 2 – Creating a dynamic list

1. Follow steps 1-3 as in Method 1
2. Click in your list.
3. Click Insert – Table
4. If your table doesn’t have a heading, leave the box for My table has headers unticked.
5. Note that it may add a “column 1” at the top.
6. You can remove that by deselecting Header Row from the Design tab (right hand side)
7. Now follow steps 5-15 from Method 1
8. The difference with this is that if you add a new item to your list, it will be automatically reflected in your data validation list
9. In order to make any changes other than the specified ones, you will have to unprotect the sheet (Review – Unprotect Sheet) by entering the password.

I want to delete the list

1. Click on Formulas – Name Manager
2. Click on the range you want to delete
3. Press Delete

I want to change the list

If you need to change the list
1. Simply follow the steps in Method 1 and at step 13, click on the new list you want to use.

How do I remove data validation?

1. Highlight the list you want to remove the data validation from
2. Choose Data – Data Validation
3. From the Allow box, choose Any Value
4. To extend the removal to all the cells, tick the Apply these changes to all other cells with the same settings box

I don’t even want other users to open my file.

1. Click on Review – Protect Workbook
2. Enter your password
3. Don’t forget to write down your password in a safe place
If you are responsible for the work of someone else, make sure they tell you what the password is. I’ve heard horror stories about disgruntled employees who have left without giving the password….(and on a side note, why don’t we call happy people gruntled…?)

OK, I’ll let them look, but not touch

1. Go to File – Save As
2. Click on Browse (if you are using Excel 2010 or later)
3. Go to folder you want to save it into.
4. Click on Tools (bottom right hand side)
5. Click General Options (nope, me neither )
6. Enter a password that allows the user to open or to modify.
7. Click OK and then Save.

I only want certain dates entered

From the Introduction, follow steps 1 – 3
1. On the Settings tab, choose Date
2. Note that from the Data tab, you can choose from any of the following:
3. Between (enter your Start Date and End Date)
4. Not Between ((enter your Start Date and End Date)
5. Equal to (enter your date here)
6. Not Equal To (Enter the date here)
7. Greater than (Enter the date here i.e. later than this date)
8. Less than (Enter the date here i.e. earlier than this date here)
9. Greater than or equal to (Enter the date here i.e. later than or equal to this date)
10. Less than or equal to (Enter the date here i.e. earlier than or equal this date here)
An example of how to use this would be to use =today() in the Date box using Less Than to restrict date entry to only those dates in the past.

I only want the users to enter certain text lengths in it.

An example of this would be where you only want users to be able to enter an 8 digit number.

1. Follow steps 1-3 from the Introduction
2. On the Settings tab, choose Text Length
3. Choose Equal to
4. Enter 8
5. Note that you have the same set of choices as referenced in the I only want certain dates entered section. i.e. greater than, lesser than etc.
6. Apply the Input Message and Error Message as above if required.

Prevention of Duplicate Entries:

It is set up by using the CountIf function.
Let’s say we want to prevent duplicates in cells M5:M100
1. From the Introduction follow steps 1-3
2. From the Allow box, choose Custom
3. In the Formula box enter the following: =COUNTIF($M$5:$M$100,M5)<=1
4. Note that what this function does is assess the range $M$5:$M$100 which is fixed. The M5 part of the formula will change as copied down. Therefore what it will do is see if what is in the current cell is counted more than once i.e. duplicate.
5. Apply your error messages if required (Introduction: steps 7-11)

I want the users to be able to sort and filter the list but not do ANYTHING ELSE.

One would think that specifying Sort and Autofilter in the Protect Sheet box would sort this. Nope, it doesn’t.
1. Highlight the area you want users to be able to sort and filter
2. Make sure the Filter is turned on (Data – Filter)
3. From Review – Allow users to Edit Ranges
4. Don’t use a password at this point
5. Click New
6. The range you have selected should appear in the dialog box
7. Click OK.
8. Then click Apply and OK
9. Now follow the instructions given in How do I stop people changing some entries?
10. Make sure the Sort and Autofilter boxes are ticked and that the Select Locked Cells and Select Unlocked Cells are deselected.
11. Note that for sorting you will have to use the Data – Sort dialog box to sort the data.


Courtesy By www. the-excel-expert.com


Friday, May 23, 2014

Thursday, May 15, 2014

Conditional Formatting Tips and Tricks

Finding the Unique Values with the help of Conditional Formatting.


Highlight mistakes, errors, omissions and repetitions

Entering large amounts of data into a spreadsheet is monotonous and pron to mistakes, omissions and repetitions. This can be avoided by using conditional formatting whenever typing or pasting a formula over a large range of cells.

To highlight a cell containing an error or omission:

Select “Conditional Formating”, “New Rule”, and “Format only cells that contain”
In the drop-down list under “Format only cells with:” select either “Error” or “Blanks” depending on what you want highlighted
Format your cells to your desired style

To highlight cells containing duplicate values:

Select “Conditional Formating”, “New Rule”, and “Format only unique or duplicate values”
Format your cells to your desired colors

Highlighting alternate rows or columns

Data presented in a large table is difficult to read because your eyes may have trouble following the rows and columns, especially when scrolling. To remedy this, try highlighting or changing the background color of alternative rows or columns. You could do this manually, but if you have a large table that keeps changing, you need to use Conditional Formatting.

Select the data section of your table you want to format
Click “Conditional formatting” in the “Home” ribbon
Click “New rule” near the bottom of the drop-down menu
Select “Use a formula to determine which cells to edit”
To highlight alternate rows, enter the formula =MOD(ROW(),2)=0 in the input box under “Format values where this formula is true:”
  This means whenever row() of the current cell is even, your desired formatting will be applied
  •   To apply formatting to odd rows, just input =MOD(ROW(),2)=1 as the formula
  •   To highlight alternate columns instead of rows, use =MOD(COLUMN(),2)=1 formula
  •   What if you want to change background color of every 3rd row: use =MOD(ROW(),3)=0 instead

Format background colors, text, text color, borders, etc to your desired style. When you are done, the dialog should look something like the sample to the right:  Click OK.

Add “In-Cell” graphs

In-cell graphing is a handy trick that basically uses REPT() function, which repeats a character a given number of times, to generate bar-charts with in a cell. You can apply conditional formatting to the characters to give the charts good effect. Here is a sample:

 The graph highlights the cells that are greater than the average number of sales for the month by changing the font color to red and making it bold.

To create the graph:

Enter the formula =REPT(“I”,C4/100) in C4 of the “Graph” column then copy the formula to the cells beneath. (You will need to adjust the “divided by 100″ depending on the size of the number in the “Amount” column)

To create the conditional formating:

Click “Conditional Formating”, “New Rules” and “Use a formula to determine which cells to format”
Under “Format values where this formula is true:” enter

=($C4>AVERAGE($C$4:$C$33))

Click “Format” and change font color to “Red” and font style to “Bold” (or whatever format you want).
Click “Okay”

Creating a quick project plan / gantt chart using conditional formatting.


Project plans / gantt charts are everyday activity in most of our lives. Creating a simple and snazzy project plan template in excel is not a difficult job, using conditional formatting a bit of formulas you can do it no time.

First create a table structure like shown above, with columns like Activity, start and end day, day 1, 2,3, etc…
Now, whenever a day falls between start and end day for a corresponding activity, we need to highlight that row. For that we need to identify whether a day falls between start and end. We can do that with the below formulas,
    =IF(AND(F$8>=$D9, F$8<=$E9),"1","")
Which means, whenever, the day number represented on the top row is between start and end we will in 1 in the corresponding cell.
Next, whenever the cell value is 1, we will just fill the cell with a favorite color and change the font to same color, so that we dont see anything but a highlighted cell, better still, whenever you change the start or end dates, the color will change automatically. This will be done by conditional formatting like below:


Highlight the Non-Multiples
Shown below is the sample data for this conditional formatting example.


To add the conditional formatting, and highlight the non-multiples in column D:
Select cells D2:D6, with D2 as the active cell
On the Excel Ribbon's Home tab, click Conditional Formatting, and click New Rule
In the New Formatting Rule dialog box, under 'Select a Rule Type', click 'Use a formula to determine which cells to format'
In the formula box, type the MOD formula:   =MOD(D2,C2) <> 0
Click Format, and on the Fill tab, select Red, then click OK, twice, to close the dialog boxes.
The MOD function returns the remainder after a number is divided by divisor. If the result is zero, then D2 is a multiple of C2.
Now the non-multiples in column D highlighted in red.


Format the Highest Value

To set up the conditional formatting for the highest value:
Select cells C2:E6, with C2 as the active cell
On the Excel Ribbon's Home tab, click Conditional Formatting, and click New Rule
In the New Formatting Rule dialog box, under 'Select a Rule Type', click 'Use a formula to determine which cells to format'
In the formula box, type the MAX formula:   =C2 = MAX($C2:$E2) The first reference to C2 is relative, so each cell will check its value compared to the MAX in the $C2:$E2 range.
Click Format, and on the Font tab, select Red as the font colour, then click OK, twice, to close the dialog boxes.



Now the highest values are highlighted in each row.



Format the Second Highest Value
To set up the conditional formatting for the second highest value:
Select cells C2:E6, with C2 as the active cell
On the Excel Ribbon's Home tab, click Conditional Formatting, and click New Rule
In the New Formatting Rule dialog box, under 'Select a Rule Type', click 'Use a formula to determine which cells to format'
In the formula box, type the LARGE formula:   =C2 = LARGE($C2:$E2,2)
Click Format, and on the Font tab, select Blue as the font colour, then click OK, twice, to close the dialog boxes.
Format the Lowest Value
To set up the conditional formatting for the second highest value:
Select cells C2:E6, with C2 as the active cell
On the Excel Ribbon's Home tab, click Conditional Formatting, and click New Rule
In the New Formatting Rule dialog box, under 'Select a Rule Type', click 'Use a formula to determine which cells to format'
In the formula box, type the MIN formula:   =C2 = MIN($C2:$E2)
Click Format, and on the Font tab, select Green as the font colour, then click OK, twice, to close the dialog boxes.
Now the highest value in each row is highlighted in red, the second highest is blue, and the lowest is green.


Validation Rule for Conditional Formatting :

Conditional formatting won't let you refer to cells on a different worksheet, or in a different workbook. However, you can refer to a workbook level named range that's on a different worksheet.



Wednesday, May 14, 2014

Excel Tips and Tricks : Date & Time

Calculate the Difference between two set of time.


A very much needed Trick to compute the difference between two set of timing:

The magic formula to use is =MOD([Departure]-[Arrival],1)



How to Calculate Over time and wages.



Create a basic time sheet as described above, add lunch breaks , if required,

Step 1: Data Entry

In Cell J1 : type employee's hourly rate
In cell J2: type employee's overtime rate.
Change the Total Hours column to read: Regular Hours (Column F)
Add a new column called: Overtime Hours (Column G)
To simplify, you might want to remove the "Total Pay" Column
Format Columns F & G to "Number" with 2 Decimal places

Step 2: Calculate Hours worked
In Cell F2, type:     =IF((((C2-B2)+(E2-D2))*24)>8,8,((C2-B2)+(E2-D2))*24)
In cell G2, type        =IF(((C2-B2)+(E2-D2))*24>8, ((C2-B2)+(E2-D2))*24-8,0)

Step 3: Drag down and total
In cell F10, sum regular hours, =SUM(F2:F8)
In cell G10, sum overtime hours =SUM(G2:G8)

Step 4: Calculate Pay:

In cell F11, type: =SUM(F10*$J$1)
In cell F12, type =SUM(G10*$J$2)
Sum F11 and F12 for total pay.  Type  =SUM(F11+G11)

CONVERT HOURS AND MINUTES INTO MINUTES

Convert Hours to Minutes in Excel. Here is how:

EXCEL 97-2003
Type your hours and minutes in an hh:mm format 
Click on "Format Cells"
On the Number Tab, under "custom", type [m] 

EXCEL 2007/2010/2013

Type your hours and minutes in an hh:mm format 
In the Excel Ribbon, Click on the Arrow Down near "Custom"
Click on "More Number Formats"
On the Number Tab, under "custom", type [m] 
Example:
Type 5:20
Change format to Custom and type [m] to see 320.

Question: How do I convert conventional hours into a decimal number?

Short Answer:
To convert hours using a calculator: 
Divide the minutes by 60. 
  
To convert hours using Excel: 
Change the cell format to "Number" with 2 decimal places and multiply it by 24

Example: My worker worked for 4hr 23 min at a rate of 13.50. How much do I pay him?
Step 1:       Divide:         23 / 60 = 0.38 
Step 2:       Add:             4 + 0.38 = 4.38
To pay your worker, multiply 4.38 by 13.50

USING EXCEL: 

If you like to use excel:
Step 1            In cell A1,                 Enter the time as hh:mm 
Step 2            In Cell B1, type         =(A1)*24 
Step 3            Change the format of Cell B to "Number" with 2 decimal places.
Example:
Step 1        In cell A1        Type 4:23  
Step 2        In cell B1       Type =(A1)*24 
Step 3        Change the format of cell B to "Number" with 2 decimal places.  You will now see 4.38
To pay your worker,  enter in cell C1 =(b1*13.50)

Make Time Count by using Formula


Imagine that you are using Excel to help you fill out a timecard by adding up the hours you work each day. To add the hours for Monday, you would type this formula in cell B4:
=(B3-B2)*24

As you type, the equal sign (=) tells Excel that this is a formula. B3 and B2 are thecell references that refer to the values in those cells. The minus sign operator tells Excel to subtract one value from the other.
Operations within parentheses are calculated first, so Excel subtracts first. Then the asterisk operator tells 
Excel to multiply the result of B3-B2 by 24, to convert that result from Excel's decimal time system to a 24-hour system. The result of the formula is 9 hours.

Computing Age

Computing someone's age from their birthday is simple, using the =DATEDIF function.  Suppose that a person's birthday is in A1. The following will return their age in Years, Month, and Days:

=DATEDIF(A1,NOW(),"y")&" Y, "& DATEDIF(A1,NOW(),"ym")& 
" M, " & DATEDIF(A1,NOW(),"md") & " D".

Creating A Series Of Workdays

If you want to create a series of dates in a column, consisting of only weekdays (Monday through Fridays), enter your starting date in a cell (A4, in the example), and then enter the following formula in the cell below that cell.

=IF(WEEKDAY(A4)=7,A4+2,IF(WEEKDAY(A4)=6,A4+3,A4+1))

Then use Fill Down to fill out your entire series of dates.

Next Day Of Week After A Date

To return the date of the next day of week following a given date, use the formula

=A1+(WEEKDAY(A1)>=C1)*7-WEEKDAY(A1)+C1

Where A1 is a date and C1 is the day-of-week number (1 = Sunday, 2 = Monday, ..., 7 = Saturday).  For example, if A1 contains the date 15-Jan-2002 (a Tuesday) and C1 contains the number 6 (indicating Friday), the formula will return 18-Jan-2002, a Friday.  

Note that if the day of week in C1 is same day of week as the date in A1, the formula returns a date 1 week later than A1.  For example, if A1 is 15-Jan-2002 (Tuesday) and C1 contains 3 (indicating Tuesday), the formula returns the date 22-Jan-2002, a Tuesday.  

If you want the formula to return the same date, use the formula

=A1+(WEEKDAY(A1)>C1)*7-WEEKDAY(A1)+C1.

Days In Month

To return the number of days in a month, use the following formula.  Suppose cell A1 contains the date 15-Jan-1998.

=DAY(DATE(YEAR(A1),MONTH(A1)+1,0))

This will return 31, the number of days in January, 1998.

First Day Of Month

You can use the following formula to get the date of the first day of the month.   Suppose the 
date in cell A1 is 15-Jan-1998.

=DATE(YEAR(A1),MONTH(A1),1)

This will return 1-Jan-1998.
Last Day Of Month

You can use the following formula to get the date of the last day of the month.   Suppose the 
date in cell A1 is 15-Jan-1998.

=DATE(YEAR(A1),MONTH(A1)+1,0)

This will return 31-Jan-1998.

First Weekday Day Of Month

You can use the following formula to get the date of the last weekday (Monday thru Friday) of the month.   Suppose the date in cell A1 is 1-June-2002.

=DATE(YEAR(A1),MONTH(A1),1)+CHOOSE(WEEKDAY(DATE(YEAR(A1),MONTH(A1),1)),1,0,0,0,0,0,2)

This will return 3-June-2002.

Last Weekday Day Of Month

You can use the following formula to get the date of the last weekday (Monday thru Friday) of the month.   Suppose the date in cell A1 is 6-Nov-2002.

=DATE(YEAR(A1),MONTH(A1)+1,0)-(MAX(0,WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,0),2)-5))

This will return 29-Nov-2002.  Another formula, given a month and year, is the following array formula:

=MAX(ROW(INDIRECT(DATE(year,month,1)&":"&DATE(year,month+1,0)))*(WEEKDAY(ROW(INDIRECT(DATE(year,month,1)&":"&DATE(year,month+1,0))),2)<6))

Last Day Of Previous Month

You can use the following formula to get the date of the last day of the previous month.  Suppose the date in cell A1 is 15-Jan-1998.

=DATE(YEAR(A1),MONTH(A1),0)

This will return 31-December-1997.

Nth Day Of Week For A Month And Year

This formula will return will return the date of Nth day-of-week for a given month and year. For example, it will return 26-March-98 for the 4th Thursday of March, 1998.   Days-of-week range from 1 to 7, with Sunday = 1 and Saturday = 7.

=DATE(Yr,Mon,1+((Nth-(DoW>=WEEKDAY(DATE(Yr,Mon,1))))*7)+
(DoW-WEEKDAY(DATE(Yr,Mon,1))))

Where Yr, Mon, Nth,  and DoW are cell references or values indicating Year, Month, Nth, and Day-Of-Week.

Nth Day Of Week For A Year

This formula will return will return the date of Nth day-of-week for a given  year. For example, it will return 11-April-2001 for the 15th Wednesday of the year 2001.   Days-of-week range from 1 to 7, with Sunday = 1 and Saturday = 7.

=DATE(Yr,1,1+(Nth-(Dow>=WEEKDAY(DATE(Yr,1,1))))*7)+
Dow-WEEKDAY(DATE(Yr,1,1))

Where Yr,Nth, and DoW are cell references or values indicating Year, Month, Nth, and Day-Of-Week.

Number Of Mondays In Period

If you need to return the number of Monday's (or any other day) that occur within an interval between two dates, use the following Array Formula: 

=SUM(IF(WEEKDAY(A2-1+ROW(INDIRECT("1:"&TRUNC(B2-A2)+1)))=C2,1,0))

This formula assumes the following: 
A2 contains the beginning date of the interval
B2 contains the ending date of the interval
C2 contains the day-of-week number (1=Sunday, 2=Monday,...,7=Saturday)

Week Differences

You cannot use the =DATEDIF function of return the difference of of two dates in weeks, so you can use the following function return the number of weeks and days between two dates:

=TRUNC((B1-A1)/7)&" Weeks "&MOD(B1-A1,7)&" Days"

What Day Is It?

If you need to know the day-of-week for a specific date, the =WEEKDAY function gives you a number between 1 and 7 indicating the day, (1=Sunday, 2=Monday, ... , 7=Saturday).   To convert this number to the actual name of the day ("Sunday", for example), use the =TEXT function: 

=TEXT(A1, "ddd") returns the three character abbreviation for the day, e.g., "Mon". 
=TEXT(A1,"dddd") returns the full name of the day, e.g., "Monday".

To determine if a date is a work day (Monday - Friday), create a name called WorkDays which refers to 
={2;3;4;5;6}

Then following function will return TRUE or FALSE, indicating whether the date in A1 is a work day:
=IF(ISERROR(VLOOKUP(WEEKDAY(A1),WorkDays,1,0)),FALSE,TRUE)

What Quarter Is It?

To return the quarter of the year, use the formula 

=ROUNDUP(MONTH(A1)/3,0) .

What Week Is It?

If you need to know what week of the year at date falls in, use the following formula:

=TRUNC(((A1-DATE(YEAR(A1),1,1))/7))+1+
IF(WEEKDAY(DATE(YEAR(A1),1,1))>WEEKDAY(A1),1,0)

This will return a number between 1 and 53, indicating the week of the year for the date in A1.

How can I calculate the date that a project ends, this date falls after a certain amount of years, months and days?