Financial Modeling Using Excel: - If - Left - Mid - Len - Find - Search
Financial Modeling Using Excel: - If - Left - Mid - Len - Find - Search
• 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")
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