Financial Modeling Using Excel: - If - Left - Mid - Len - Find - Search

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

Financial Modeling Using Excel

• if
• LEFT
• MID
• LEN
• Find
• Search
IF() Function
• Form
– =IF(condition,
value-for-TRUE-case,
value-for-FALSE-case)
• Example
– Assume: B2 contains semester average
– Then, in C2, we can have:
=IF(B2>=70, “Pass”, “Fail”)
IF() Function
A B C D E F
1 Name Exam Grade
2 Adams 87 Pass
3 Benson 92 Pass
4 Carson 68 Fail
5 Danson 78 Pass
6

=IF(B2>=70,”Pass”,”Fail”)
Worksheet Practice
• Find companies with CSR less than 2% of Average Net Profit.
=IF(E2<2,"VIOLATION","NO VIOLATION")

• Grade the Companies:


– 0-2%
– 2-3%
– 3-5%
– More than 5
=IF(E2<0.02,"E",IF(E2<0.03,"D", IF(E2<0.05,
"C","B")))
LEFT
• The Excel LEFT function extracts a given number of characters from the
left side of a supplied text string.

• =LEFT (text, [num_chars])


• For example, LEFT("apple",3) returns "app".
MID FUNCTION

The Excel MID function extracts a given number of characters from the middle
of a supplied text string.
For example, =MID("apple",2,3) returns "ppl".
=MID (text, start_num, num_chars)
Use the MID function when you want to extract text from inside a text string,
based on location and length.
LEN
• =LEN (text)
• Usage notes 
– LEN is a useful when you want to count how many
characters there are in some text.
– Numbers and dates will also return a length.
– Number formatting is not included. (i.e. the length
of "100" formatted as "$100.00" is still 3).
FIND
• FIND( find_text, within_text, [start_num] )
• The first 2 arguments are required, the last one is optional.
• Find_text - the character or substring you want to find.
• Within_text - the text string to be searched within. Usually it's
supplied as a cell reference, but you can also type the string
directly in the formula.
• Start_num - an optional argument that specifies from which
character the search shall begin. If omitted, the search starts
from the 1st character of the within_text string.
• If the FIND function does not find the find_text character(s), a
#VALUE! error is returned.
FIND
• The FIND function is case sensitive. If you are looking for a case-insensitive match,
use the SEARCH function.
• The FIND function in Excel does not allow using wildcard characters.
• If the find_text argument contains several characters, the FIND function returns
the position of the first character. For example, the formula FIND("ap","happy")
returns 2 because "a" in the 2nd letter in the word "happy".
• If within_text contains several occurrences of find_text, the first occurrence is
returned. For example, FIND("l", "hello") returns 3, which is the position of the first
"l" character in the word "hello".
• If find_text is an empty string "", the Excel FIND formula returns the first character
in the search string.
• The Excel FIND function returns the #VALUE! error if any of the following occurs:
– Find_text does not exist in within_text.
– Start_num contains more characters than within_text.
– Start_num is 0 (zero) or a negative number.
SEARCH function
• The SEARCH function in Excel is very similar to FIND in
that it also returns the location of a substring in a text
string. Is syntax and arguments are akin to those of
FIND:
• And here's a couple of basic Excel SEARCH formulas:
• =SEARCH("market", "supermarket") returns 6 because
the substring "market" begins at the 6th character of
the word "supermarket".
• =SEARCH("e", "Excel") returns 1 because "e" is the first
character in the word "Excel", ignoring the case.
SEARCH function
Excel FIND vs. Excel SEARCH

• The SEARCH function in Excel is very similar to FIND in that it


also returns the location of a substring in a text string. Is
syntax and arguments are akin to those of FIND:

1. Case-sensitive FIND vs. case-insensitive SEARCH

2. Search with wildcard characters


• Unlike FIND, the Excel SEARCH function allows
using wildcards in the find_text argument:
• A question mark (?) matches one character,
and
• An asterisk (*) matches any series of
characters.
• As you see in the screenshot above, the formula
SEARCH("function*2013", A2) returns the position
of the first character ("f") in the substring if the
text string referred to in the within_text argument
contains both "function" and "2013", no matter
how many other characters there are in between.
• Tip. To find an actual question mark (?) or asterisk
(*), type a tilde (~) before the corresponding
character.
• Supposing you have a column of names (column A) and
you want to pull the First name and Last name into
separate columns.
• To get the first name, you can use FIND (or SEARCH) in
conjunction with the LEFT function:
• =LEFT(A2, FIND(" ", A2)-1)
• =LEFT(A2, SEARCH(" ", A2)-1)
• As you probably know, the Excel LEFT function returns the specified number of
left-most characters in a string. And you use the FIND function to determine
the position of a space (" ") to let the LEFT function know how many characters
to extract. At that, you subtract 1 from the space's position because you don't
want the returned value to include the space.
• To extract the last name, use the combination of the RIGHT, FIND / SEARCH and
LEN functions. The LEN function is needed to get the total number of
characters in the string, from which you subtract the position of the space:
• =RIGHT(A2,LEN(A2)-FIND(" ",A2))

=RIGHT(A2,LEN(A2)-SEARCH(" ",A2))
https://www.ablebits.com/office-addins-
blog/2015/10/07/excel-find-search-functions/

You might also like