Why Are Excel Formulas Important
Why Are Excel Formulas Important
We have learned to add the formula to a single row. Now, we will learn to
apply the same formula to the entire column.
There are multiple ways to add formulas:
Dragging down the fill handle: when you select the cell, you will
see the small green box at the bottom right. It is called a fill handle.
Click and hold the fill handle and drag it down to the last row. It is
commonly used to apply formulas to selected rows.
Double click the fill handle: select the cell with the formula and
double click the fill handle. Within seconds it will apply the formula to
the entire column.
Shortcut: select the cell with the formula and the empty cells below
it. Press CTRL + D to apply the formula. Make sure you are not
selecting anything above the formula cell.
Copy-pasting: copy the cell with the formula (CTRL + C), select the
empty rows in a column, and paste it (CTRL + V). Make sure you are
not using a fill handle to select the rows.
The visual representation below shows all the ways we can apply the
formula to multiple cells.
Formula for an entire column | Author
1. SUM()
POWERED BY
2. MIN() and MAX()
The MIN() function requires a range of cells, and it returns the minimum
value. For example, we want to display the minimum weight among all
athletes on the E6 cell. The MIN() function will search for the minimum value
and show 60.
=MIN(E2:E5)
POWERED BY
The MAX() function is the opposite of MIN(). It will return the maximum value
from the selected range of cells. The function will look for the maximum
value and return 82.
=MAX(E2:E5)
POWERED BY
3. AVERAGE()
The AVERAGE() function calculates the average of selected cells. You can
provide a range of cells (C2:C5) or select individual cells (C2, C3, C5).
To calculate the average of athletes, we will select the age column, apply
the average function, and return the result to the C7 cell. It will sum up the
total values in the selected cells and divide them by 4.
=AVERAGE(C2:C5)
POWERED BY
4. COUNT()
The COUNT() function counts the total number of selected cells. It will not
count the blank cells and different data formats other than numeric.
We will count the total number of athlete weights, and it will return 4, as we
don’t have missing values or strings.
=COUNT(E2:E5)
POWERED BY
To count all types of cells (date-time, string, numerical), you need to use
the COUNTA() function.
The COUNTA() function does not count missing values. For blank cells,
use COUNTBLANK().
5. POWER()
POWERED BY
6. CEILING() and FLOOR()
POWERED BY
POWERED BY
7. CONCAT()
The CONCAT() Excel function joins or merges multiple strings or cells with
strings into one. For example, if we want to join the age and sex of the
athletes, we will use CONCAT(). The function will automatically convert a
numeric value from age to string and combine it.
“24”+“M” = “24M”
=CONCAT(C2,B2)
POWERED BY
8. TRIM()
TRIM()is used to remove extra spaces from the start, middle, and end. It is
commonly used to identify duplicate values in cells, and for some reason,
extra space makes it unique.
For example:
1. There are extra two spaces at A3 “A Lamusi”, and it has been
successfully removed by TRIM().
2. At A4 “ Christie Jacoba Aaftink”, there is extra space at the start, and
without writing any complex function, TRIM() has removed it.
=TRIM(A4)
POWERED BY
REPLACE() is used for replacing part of the string with a new string.
REPLACE(old_text, start_num, num_chars, new_text)
old_text is the original text or cell containing the text.
start_numis the index position that you want to start replacing the
character.
num_chars refers to the number of characters you want to replace.
new_text indicates the new text that you want to replace with old text.
For example, we will change A Dijiang with B Dijiang by providing the
positing of character, which is 1, the number of characters that we want to
replace, which is also 1, and the new character “B”.
=REPLACE(A2,1,1,"B")
POWERED BY
The SUBSTITUTE() function is similar to REPLACE(). Instead of providing the
location of a character or the number of characters, we will only provide old
text and new text.
SUBSTITUTE(text, old_text, new_text, [instance_num])
In our case, we are replacing "Jacoba" with "Rahim" to display the result on
A4 cell “Christine Rahim Aaftink.”
This function is quite useful as it does not change the text without “Jacoba”
as shown below in cell A5, “Per Knut Aaland.” Whereas, REPLACE() will
replace the text every time.
=SUBSTITUTE(A4,"Jacoba","Rahim")
POWERED BY
POWERED BY
The MID() function requires a starting position and length to extract the
characters from the middle.
For example, if you want to display a middle name, you will start with “J”
which is at the 11th position, and 6 for the length of the middle name
“Jacoba”.
=MID(A2,11,6)
POWERED BY
The RIGHT() function will return the number of characters from the end. You
just need to provide a number of characters.
For example, to display the last name “Aaftink,” we will use RIGHT() with
seven characters.
=RIGHT(A2,7)
POWERED BY
The UPPER(), LOWER(), and PROPER() functions are basic string operations.
You can find similar in Tableau or in Python. These functinos only require a
text, the location of the cell containing string, or the range of cells with
string.
UPPER() will convert all the letters in the text to uppercase.
=UPPER(A1:F1)
POWERED BY
POWERED BY
PROPER() will convert the string to the proper case. For example, the first
letter in each word will be capitalized, and the rest of them will be
lowercase.
=PROPER(A1:F1)
POWERED BY
POWERED BY
To extract the seconds from the time, you will use the SECOND() function.
=SECOND(NOW())
POWERED BY
POWERED BY
To extract the day, you will use the DAY() function.
Furthermore, you can extract month, year, weekday, day names, hours,
and minutes from the date time data field.
=DAY(TODAY())
POWERED BY
13. DATEDIF()
POWERED BY
14. VLOOKUP() and HLOOKUP()
The worksheet1 that we will use in this section contains all the data
from the Olympics dataset.
worksheet1
The VLOOKUP() function searches for the value in the leftmost column of the
table array and returns the value from the same row from the specified
columns.
VLOOKUP(lookup_value, table_array, col_index,
range_lookup)
lookup_value: the value you are looking for that is present in the first
column.
table_array:
the range of the table, worksheet, or selected cell with
multiple columns.
col_index: the position of the column to extract the value.
range_lookup:
“True” is used for the approximate match (default), and
“FALSE” is used for the exact match.
In our case, we are looking for A Dijiang (A2) from selected columns and
rows of worksheet1 (B2:H20). The VLOOKUP() function will check the name
column in worksheet one and return the 6th column value that is team
“China”.
=VLOOKUP(A2,worksheet1!B2:H20,6,FALSE)
POWERED BY
HLOOKUP() searches for the value in the first row instead of the first column.
It returns the value from the same column and the row you specified.
HLOOKUP(lookup_value, table_array, row_index,
range_lookup)
In our case, we will display A Dijaing’s sex on the D8 cell.
The HLOOKUP() function will look for the name in the first row and return the
value “M'' from the 2nd row of the same column. The range_lookup is kept
FALSE in both cases for the exact match.
=HLOOKUP(B1,B1;E5,2,FALSE)
POWERED BY
15. IF()
The IF() Excel function is straightforward. It is similar to an if-else statement
in a programming language. We will provide the logic of the function. If the
logic is correct, it will return a certain value; if the logic is false, it will return
a different value.
For example, if the BMI of athletics is less than 23.9, the function will return
the string “Fit”, else “Unfit”. It is quite useful to convert numerical values into
categories.
=IF(G2<24.9,"Fit,"Unfit")
POWERED BY
Array formulas