Excel Day2
Excel Day2
Cell References:
A cell is an intersection between a row and a column. Cell reference is like an address
for a cell.
Here D3 is the cell reference where D is column name and ‘3’ is row no.
Relative References: All the references we have used so far are
relative reference. Relative reference changes when the formula is
copied to another cell.
Absolute reference: This reference does not change when the
formula is moved across cells: $A$1. Here $ locks a specific row
or column.
Here we can see that for customer 1, Rs.5000 is added but when
we try to drag so that every cell in Yearly fixed bonus should get
it,does not happened.
So now the solution is to freeze the Rs.5000 value by using F4 or
manually ping $ sign in front of F4 in my scenario. Now drag the
column and u will get correct values.
Mixed References: As the name suggest, these are references in
which one part is absolute and the other part is relative.e.g A$2 or
$B2.
Drag the 3rd row as shown, Here we wanted B3+D3, but it
adds C3+D3and that is resulting in wrong output (2158)
So now fix the column B and let rows change
using $ in front of B only (Mixed reference)
Now drag so that u can get correct values
Excel Functions:
UPPER Function:
Syntax: = UPPER(text)
Converts text into uppercase.
Exercise: Convert all the company name to uppercase.
Use Upper Function
LOWER()
Exercise:
Convert the company name in lower case using function Lower(),
Proper(Text)
Capitalizes the first letter in each word of a text value.
Exercise-Convert all the headquarters in our dataset to proper case.
LEN(text)
Counts the number of chacters(alphabets, special symbols etc) in
text.
Exercise: Find the top 10 companies with the longest name in our
dataset. Use LEN and Sorting.
Solution:
LEFT(text, number of characters)
Extract the left most characters from text.
Exercise- Extract the left 3 characters from all companies and arrange them in
alphabetical order (A-Z).
Left(Text, no), now use Right and Mid
function
RIGHT(text, number of characters)
Extract the right most characters from text.
Exercise- Extract the right 2 characters from all the companies and arrange them in
alphabetical order.
MID(text,start number, number of characters)
Extracts characters from the middle of text. Start number signifies the first letter
that will be extracted, and number of character specifies how many characters are
extracted.
Exercise: Extract the middle 4 characters of all the company names, starting
from 3rd Character.
TRIM(text)
The Trim function removes additional spaces before and after a text
entry. It will keep spaces within the text entry intact.
Exercise: Trim all the company names and headquarters.
SUBSTITUTE(full text, text to be replaced, replacement text, instance number).
SUBSTITUTE takes the full text, finds the text to be replaced, deletes that, and puts
in replacement text in its place. If the text to be replaced appears multiple times,
every instance of it is replaced, unless you specify the instance number.
Exercise: Replace all “IT” in tags column with “Tech”.
Exercise:
1) Convert Name, Company_type, Headquarter, and tags to Proper case. Trim
any extra space in these fields.
2) Remove the string “Employees (India)” in No. of employees (replace it with
“”).
3) Substitute “Govt” in type company_type “Government”. Extract the first 3
letters of all company names.
IF(logical test,[output if true],[output if false])
Exercise: If a company gets rating greater than 4.5, it is called a
“Great Place to work”, if false: “Don’t Joint”.
If (condition,”True”,”False”)
Exercise: If the age of a company is lesser than 10, it is considered
a start-up, and otherwise, it is considered an established company.U
can use flash Fill in Data section.
Exercise: In the company name, if company name characters are
less than 6, then write “Short Name” else write “Long Name” (Use
IF Function)
If(LEN(B2)>=6, “LongName”, “ShortName”)
Exercise: If the age of a company is lesser than 10, it is considered a start-up,
and otherwise, it is considered an established company. Research has shown that
start ups are actually rated lower than established companies. To reflect actual
rating add 0.1 rating to startups and do not any thing for established companies.
TODAY()
Returns the current date.
NOW(): Returns the current Date and time.
Now mainly gives in date and time format but we can use custom
formats to convert it.
Click on More number formats: Here we used
AM/PM
Extracting Parts of a Date:
YEAR(): extracts the year from a given date.
MONTH(): extracts the month from a given date.
DAY(): extracts the month day number from a given date.
WEEKDAY(): returns the weekday number for a given date.
WEEKNUM(): returns the week number for a given date.
WeekNumber
Using Text Function:
=TEXT(value, format)
1) d- Date in number format.(this will return 21 for 21-Jan-1995)
2) dddd-Day(this will return the full day name e.g Saturday)
3) ddd- Day in short form
4) mm- This will return month number. E.g. 01
5) mmmm-Month name (January)
6) mmm- month name short(e.g Jan)
7) yyyy- Full year number(e.g 1995).
8) yy- Last 2 digits of the year.
Text format for date.
Activity: Use other formats
Exercise: Use TODAY function to generate today’s date and
convert it to Saturday, 21 January 22 format.
Text(E12, “dddd, d,mmmm yy”)
Extracting Parts of TIME:
HOUR extract the hour portion of a given time value.
MINUTE extracts the minute portion of a given time value.
SECOND extracts the second portion of a given time value.
Now()
Do this at any cell and you will get current
date and current time.
SumIF
Range: (required argument) – This is the range of cells that we want to apply
the criteria against.
Criteria: (required argument) – This is the criteria which are used to determine
which cells need to be added.
Sum_range: (optional) – Range to sum. If omitted, cells in range are summed.
For example, the formula “=SUMIF(B1:B5, “<=12”)” adds the values in the cell
range B1:B5, which are less than or equal to 12.
You can also apply the criteria to one range and sum the corresponding values
in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5)
sums only the values in the range C2:C5, where the corresponding cells in the
range B2:B5 equal "John“
Find the sum of sales and then find the sum of sales only
for North region, so here range is B3:B11,criteria is
“north” and sum range is D3:D11.
Exercise: Find for EAST, WEST and SOUTH region
also.
SumIFS:
Find the sum of sales for north region, where state is punjab. So here we
have multiple condition, so we will use SumIfs. Here Sum_range is
D3:D11, Criteria_range1 is B3: B11, Criteria 1 is “north”,
Criteria_range2 is C3:C11, and Criteria 2 is “punjab”