excel basic part 3
excel basic part 3
Note: Dates are in US Format. Months first, Days second. This type of format depends on your windows regional
settings. Learn more about Date and Time formats.
Year, Month, Day
To get the year of a date, use the YEAR function.
Note: use the MONTH and DAY function to get the month and day of a date.
Date Function
1. To add a number of days to a date, use the following simple formula.
2. To add a number of years, months and/or days, use the DATE function.
Note: the DATE function accepts three arguments: year, month and day. Excel knows that 6 + 2 = 8 = August has 31
days and rolls over to the next month (23 August + 9 days = 1 September).
Page no. 36
Excel Training by Manish
Note: use the MINUTE and SECOND function to return the minute and second.
Time Function
To add a number of hours, minutes and/or seconds, use the TIME function.
Page no. 37
Excel Training by Manish
CONCATENATE in Excel
Use CONCATENATE, CONCAT, TEXTJOIN or the & operator in Excel to concatenate (join) two or more text
strings.
1. The CONCATENATE function below concatenates the string in cell A1 and the string in cell B1.
3. The CONCATENATE function below concatenates the string in cell A1, the string " and " (enclose text in double
quotation marks) and the string in cell B1.
5. The CONCATENATE function below concatenates the string in cell A1, a space and the string in cell B1.
Page no. 38
Excel Training by Manish
The CONCAT function in Excel 2016 or later produces the exact same result as the CONCATENATE function. Simply
replace CONCATENATE with CONCAT in the formulas shown above.
7. The CONCAT function can also join a range of strings. If you don't need a delimiter (space, comma, dash, etc.) this
can be useful.
The TEXTJOIN function in Excel 2016 or later joins a range of strings using a delimiter (first argument).
8. First, take a look at all the extra spaces in column E below when you drag the CONCATENATE function in cell E2
down to cell E11.
9. The beauty of the TEXTJOIN function is that it can ignore empty cells (if the second argument is set to TRUE).
10. When using the CONCATENATE function, use the TEXT function to format numbers.
Page no. 39
Excel Training by Manish
Note: use 0 to display the nearest integer value. Use 0.0 for one decimal place. Use 0.00 for two decimal places, etc.
Visit our page about the TEXT function for many more examples.
11. Use CHAR(10) to insert a line break.
Note: don't forget to enable text wrapping. On the Home tab, in the Alignment group, click Wrap Text.
12. Let's take a look at one more cool example that uses the TEXTJOIN function. First, the IF function below finds all
members of Team 1.
Explanation: the IF function checks each cell in the named range Teams. If equal to the value in cell E3, it returns the
name from the named range Names, else it returns an empty string (two double quotes with nothing in between).
13. The IF function returns an array constant stored in Excel's memory. Select the formula in the formula bar and press
F9 to see this array constant.
Page no. 40
Excel Training by Manish
14. Add the powerful TEXTJOIN function to concatenate these names. Use a comma and space as the delimiter (first
argument) and set the second argument to TRUE to ignore the empty strings. Finish an array formula by pressing
CTRL + SHIFT + ENTER.
Note: Excel adds the curly braces {}. Using Excel 365 or Excel 2021? Finish by simply pressing Enter. You won't see
curly braces. Mia, James and Sophia are in Team 1. Double click the lower right corner of cell F3 to quickly copy this
formula to the other cells.
Page no. 41
Excel Training by Manish
Note: instead of using the & operator, use the CONCATENATE function in Excel.
Left
To extract the leftmost characters from a string, use the LEFT function.
Right
To extract the rightmost characters from a string, use the RIGHT function.
Mid
To extract a substring, starting in the middle of a string, use the MID function.
Len
To get the length of a string, use the LEN function.
Page no. 42
Excel Training by Manish
Find
To find the position of a substring in a string, use the FIND function.
Note: string "am" found at position 3. Visit our page about the FIND function for more examples.
Substitute
To replace existing text with new text in a string, use the SUBSTITUTE function.
Page no. 43
Excel Training by Manish
Explanation: the VLOOKUP function looks for the ID (104) in the leftmost column of the range $E$4:$G$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
FALSE to return an exact match or a #N/A error if not found.
Page no. 44
Excel Training by Manish
Note: when we drag the VLOOKUP function down, the absolute reference ($E$4:$G$7) stays the same, while the
relative reference (A2) changes to A3, A4, A5, etc. Visit our page about the VLOOKUP function for much more
information and many examples.
Hlookup
In a similar way, you can use the HLOOKUP (Horizontal lookup) function.
Note: if you have Excel 365 or Excel 2021, use XLOOKUP instead of HLOOKUP to perform a horizontal lookup.
Match
The MATCH function returns the position of a value in a given range.
Explanation: Yellow found at position 3 in the range E4:E7. The third argument is optional. Set this argument to 0 to
return the position of the value that is exactly equal to lookup_value (A2) or a #N/A error if not found. Use INDEX and
MATCH in Excel and impress your boss.
Index
The INDEX function below returns a specific value in a two-dimensional range.
Page no. 45
Excel Training by Manish
Explanation: 92 found at the intersection of row 3 and column 2 in the range E4:F7.
Explanation: 97 found at position 3 in the range E4:E7. Use INDEX and MATCH in Excel and impress your boss.
Choose
The CHOOSE function returns a value from a list of values, based on a position number.
Page no. 46