You are on page 1of 33

50 C

IF

The function uses the following arguments:

Logical_test (required argument) – This is the condition to be tested and evaluated as either TRUE
or FALSE.
Value_if_true (optional argument) – The value that will be returned if the logical_test evaluates to
TRUE.
Value_if_false (optional argument) – The value that will be returned if the logical_test evaluates to
FALSE.
When using the IF function to construct a test, we can use the following logical operators:

= (equal to)
> (greater than)
>= (greater than or equal to)
< (less than)
<= (less than or equal to)
<> (not equal to)

example 1

10 12

Fail

example 2

Unit quantity Price per unit


1 to 10 $30
11 to 25 $28
26 to 65 $25
65 and above $22

Quantity 2
Total 60

Example 3

AGM Preparation list Status Remarks


Directors report to be finalised and sent for review Closed 1/1/2018
Finalize Annual report Open
AGM Notice Closed 1/15/2018
Prepare attendance register Open
Ready the documents needed Open
Follow up with Auditors Open

Example 4

Marks
85
79
90 fail
60 PASS A
80 fail D
75 fail B

S.no
1
2
3
4
5
6

VLOOKUP

In its simplest form, the VLOOKUP function says:


Parameters or Arguments
value
=VLOOKUP(What you want to look up, where
you want to look for it, the column number in
the range containing the value to return, return
an Approximate or Exact match – indicated as
1/TRUE, or 0/FALSE). The value to search for in the first colu
table
Two or more columns of data that is s
index_number
The column number in table from whi
approximate_match
Optional. Enter FALSE to find an exact
Exmple 1
Order ID Product Unit Price
10247 Apples $14.00
10249 Oranges $9.80
10250 Bananas $34.80
10251 Pears $18.60
10252 Grapes $42.30

example 2

product qty

Apple 100
Avacado 52
Pine Apple 0
Guava 0
lemon 52
Water malon 63

exmple 3

Receipt_Id Item Quantity


348885324 Kroger 15
350225451 Shaws_Mark 10
350515575 Gate_beyon 18
354631726 McDonalds 500
356174666 Bp 60
357084685 Heb 85
358297931 Tobacco_Bar 59
359861951 Hyvee 42
360728080 7_Eleven 100
364859383 Safeway 0
365044091 Market_Bask 68
367144409 Dollar_Tree 36
368159166 Stop_and_S 95
370722834 Carlton_Mea 3

exmple 4

Commission Table
Sales Tiers Tier Minim Payout Rate
$0-$50,000 $0 $500
$50,001-$100,000 $50,001 $1,000
$100,001-$150,000 $100,001 $2,000
$150,001+ $150,001 $5,000

Sales AmounPayout Rate


Lookup Value-> $50,001 $1,000
If, VLoopkup, HLookup

81 A+
71 B
30

HLOOKUP

Axles Bearings Bolts


4 4 9

* 5 7 10
6 8 11

0
or Arguments

search for in the first column of the table.

columns of data that is sorted in ascending order.

number in table from which the matching value must be returned. The first column is 1.

er FALSE to find an exact match. Enter TRUE to find an approximate match. If this parameter is omitted, TRUE is the default.

Quantity
12 Order ID 10252
10
5 Product Grapes
9 UP 42.3
40 qty 40

Total 1692

Product guava

In stock No

Total Item In Stock?


37.34 safeway No
34.2
18.81
12.33
5.01
40.01
61.7
28.62
8.72
50.86
176.34
3.18
15.17
6.47

Payout Rate

Payout Rate
4

0
0
10
Exmple 1
Order ID Product Unit Price
10247 Apples $14.00
10249 Oranges $9.80
10250 Bananas $34.80
10251 Pears $18.60
10252 Grapes $42.30

Order ID 10252

Product Grapes
Unit Price 42.3
Quantity 12

Total 507.6

Imagine you have an employee database where Column A lists Employee IDs, Column B lists employee names, and Column C lis

ID Names Email
10245 x x@gmail
14421 y Y@gmail
14254 z z@gmail
12457 h h@gmail

ID 12457

Name x
Email x@gmail

Scenario: Product Stock Level Check

Imagine you have a list of products in a table where:

Column A lists Product IDs.


Column B lists Product Names.
Column C lists the current stock levels.

You want to check the stock level of a specific product by its Product ID and return a custom message based on the stock level f
Goal:

If the product is found and its stock level is below 10, return "Low Stock".
If the product is found and its stock level is 10 or above, return "Stock OK".
If the product is not found in the list, return "Product Not Found".

B C
Product Stock
Product ID
Name Level
1 Product A 25
2 Product B 8
3 Product C 15
4 Product D 3
5 Product E 12

Product ID 6
Stock check Product not found
oyee names, and Column C lists their email addresses. You want to find the email address of an employee given their Employee ID.

sage based on the stock level found.


en their Employee ID.
Product Stock
Product ID
Name Level Product ID 3
1 Product A 25 Stock OK
2 Product B 8
3 Product C 15
4 Product D 3
5 Product E 12
Let's say you have a loan of $10,000, w

PMT -299

loan
intrest rate
period

Rs0.00
you have a loan of $10,000, with an annual interest rate of 5% (monthly interest rate of 5%/12), divided into principal and interest, as well
to be paid over 3 years (36 months). You want to create a table to see each payment amount and how it is

10000
5% annual
36 months 8%
10
1000

-Rs149.03
-Rs299.71
principal and interest, as well as the remaining balance.
Date Payment
16-Feb-01 -600 15%
5-Apr-01 100
15-Jul-01 100
22-Sep-01 100
22-Sep-02 100
22-Sep-03 100
22-Sep-04 100
22-Sep-05 100
22-Sep-06 100
22-Sep-07 100
22-Sep-08 100
22-Sep-09 100

12%
22%

97.29446
Suppose you have a grading system where:

A score of 90 and above is an A,


A score of 80 to 89 is a B,
A score of 70 to 79 is a C,
A score of 60 to 69 is a D,
Any score below 60 is an F.
SALES BONUS
A 100000
B 80000
40 C B C 150000

10000 NO BONUS

Sales below $5,000 receive no commission,


Sales from $5,000 to $10,000 receive a 5% commission,
Sales from $10,001 to $15,000 receive a 10% commission,
Sales above $15,000 receive a 15% commission.

6000 300 300

Less than 2 years of service gets no bonus,


2 to 4 years of service gets a $500 bonus,
5 to 9 years of service gets a $1,000 bonus,
10 years and above gets a $2,000 bonus.

10 2000

example 2

Unit quantPrice per unit


1 to 10 $30
11 to 25 $28
26 to 65 $25
65 and abo $22

Quantity 2
Total 60
IF with and

name sales transactionbons


a 100000 10 10000
b 150000 12 10000
c 800000 15 10000
d 60000 8 No bonus
e 150000 8 10000

22
15
FALSE

22
-15
FALSE
example 1

65 45

FALSE

example 2

Tax Calculator
Slabs
0 - 600000 No Tax
600001 - 1200000 5%
1200001 - 2400000 3000 & 10% above 2000000

Taxable A 2500000

Tax Amount FALSE =IF(AND(B17>0,B17<=600000),0,IF(AND(B17

FALSE
500000

500000

EXAMPE 3

YEARS OF SERVICE NO OF SALES BONUS


1 5 101 BONUS
2 4 102 No bonus
3 6 89 No bonus
4 7 80 No bonus

example

sales attendence customer feed back

10001 4 9 1000
10001 5 9 500
12000 6 8 200
8900 1 4 0
7800 1 4 0
IF(AND(A2>10000, B2<5,
C2>8), 1000,
IF(AND(A2>10000,
OR(B2<5, C2>8)), 500,
IF(A2>10000, 200, 0)))
3000 ,+ 50000 53000

<=600000),0,IF(AND(B17>=600001,B17<=1200000),(B17-600000)*D14,IF(AND(B17>=1200001,B17<2400000),3000+(IF(B17>2000000,(B17

Employees are evaluated on three criteria:

Sales (Column A): Must exceed $10,000 to be considered for a bonus.


Attendance (Column B): Must have fewer than 5 days absent.
Customer Feedback Score (Column C): Must be above 8 (out of 10).

Bonuses are determined as follows:

If all three criteria are met, the bonus is $1,000.


If only the sales and either attendance or customer feedback criteria are met, the bonus is $500.
If only the sales criteria are met, the bonus is $200.

Otherwise, no bonus.
),3000+(IF(B17>2000000,(B17-2000000)*10%)))))
COUNT 1 0
5 4
S 1
5
3 0

countA 9

count ali count how many sales figures in a list are greater than
coutif ali 500
ali 501
raza 490
khan 600

1 2
d
s

3
example 1
Jan feb mar
sales 1000 800 1200

month
jan

sales 1000

exampe 2
Employee
2 John Doe January February March April
3 Jane Doe Excellent Good Good Satisfactory

Imagine you have a dataset that contains monthly perfor


Month
june If the performance rating is "Excellent", the employee r
If the rating is "Good", the bonus is $500.
John Doe 1000 If the rating is "Satisfactory", the bonus is $200.
Otherwise, the employee does not receive a bonus.
april
1200

May June
Good Excellent

aset that contains monthly performance ratings for employees, and you want to determine their eligibility for a year-end bonus based on the

ing is "Excellent", the employee receives a $1,000 bonus.


, the bonus is $500.
ctory", the bonus is $200.
yee does not receive a bonus.
or a year-end bonus based on their performance in a specific month. The eligibility criteria are as follows:
Now , Today , Date , Weekday , Month , Datedif

Now 3/29/2024 5:02


Today 3/29/2024

Date
year Month Day
2020 1 25 Saturday, January 25, 2020
2020 2 4 Tuesday, February 4, 2020
2020 5 812 Thursday, July 21, 2022
2020 6 3 Wednesday, June 3, 2020
2020 8 30 Sunday, August 30, 2020
2020 12 5 Saturday, December 5, 2020

weekday

month 1
2
7
6
8
12

example 1

IF with dates

loan date status


1 24-Nov-23 Overdue
2 25-Dec-23 Overdue
3 1-Jan-24 Not due

example 2 You want to check if an employee's contract date is before or after a certa

emp contract date decision


1 4/12/2022 Renew
2 2/16/2021 Renew
3 2/2/2023 Valid
4 3/3/2023 Valid

example 3 if and date Suppose you're managing a marketing cam


first half of the year (January 1 - June 30). s
If it does, return "S1", otherwise "S2" for th
Campaign
Start Date Semester
Name
Campaign 1 1/15/2024 S1 S1
Campaign 2 7/9/2024 S2 S2
Campaign 3 3/22/2024 S1 S1
Campaign 4 10/5/2024 S2 S2
ract date is before or after a certain date and return "Renew" if the contract date is before January 1, 2023, or "Valid" if it's after

you're managing a marketing campaign and want to check if a particular campaign start date in cell falls in the
of the year (January 1 - June 30). second half of the year.
return "S1", otherwise "S2" for the
"Valid" if it's after

You might also like