Lesson 7 Microsoft Excel Part 4
Lesson 7 Microsoft Excel Part 4
Office Excel
Date & Time Functions
To enter a date in Excel, use the "/" or "-" characters. To enter a time, use the ":"
(colon). You can also enter a date and a time in one cell.
Year, Month, Day
To get the year of a date, use the YEAR function.
Date Function
1. To add a number of days to a date, use the following simple formula.
Date Function
2. To add 4 years, 2 months and 9 days, use the DATE function.
Current Date & Time
To get the current date and time, use the NOW function.
Hour, Minute and Second
To get the current date and time, use the NOW function.
Time Function
To add a 2 hours, 10 minutes and 70 seconds, use the TIME function.
Text Functions
Join Strings use the & operator.
Age Calculation
The DATEDIF function in Excel is used to figure out a person's age. It is a built-
in, easy-to-use function that takes the person's date of birth as an input and gives
back the person's age as output.
The syntax to calculate the age of a person using the YEARFRAC function is
defined as below:
YEARFRAC Function
Formula: =INT(YEARFRAC(B2,TODAY()))
Calculating Age in Months
From the previous formula for DATEDIF change the unit from “Y” to “M” in the
formula.
=DATEDIF(B2,TODAY(),"M")
Calculating Age in Years, Months, and Days
=DATEDIF(B2,TODAY(),"Y") & " Years, " & DATEDIF(B2,TODAY(),"YM")
& " Months, " & DATEDIF(B2,TODAY(),"MD") & " Days"
Text Functions
To extract the leftmost characters from a string, use the LEFT function. The 2 is
the number of letter to be display
Text Functions
To extract the rightmost characters from a string, use the RIGHT function.
Text Functions
To extract a substring, starting in the middle of a string, use the MID function.
Started at position 3 (p) with length 2.
Text Functions
To get the length of a string, use the LEN function.
Text Functions
To replace existing text with new text in a string, use the SUBSTITUTE function.
VLOOKUP
1. Insert the VLOOKUP function shown below.
VLOOKUP
Explanation: the VLOOKUP function looks for the ID (104) in the leftmost
column of the range $D$4:$F$7 and returns the value in the same row from the
third column (third argument is set to 3). The fourth argument is set to 0 (FALSE)
to return an exact match or a #N/A error if not found.