***************

A couple of days ago, I received a question from a reader asking how to use the IF function in Excel for a particular scenario he needed to do at work. I thought other people might benefit from having a short tutorial on this, so I’m providing it here, divided into a few parts.

The first part (here) will go into the basic IF statement, and subsequent parts, such as how to use nested IF functions with other logical operators, will describe how to use it in slightly more complicated scenarios or with additional features. For example, the reader’s question had to do with using an IF statement given two conditions, e.g. if a number falls * between* two other numbers. I address those in the separate post in the link above.

But, let’s go over the basic IF function here, first.

Let’s say that you have a series of numbers in Excel like this that represent sales figures that 10 of your salesmen have made this quarter, in column B:

Before we go further, if you’d like to work through the examples yourself, here’s the raw data you can copy into an Excel worksheet. First, open up a blank excel worksheet. Next, highlight the table below. Copy it, and then go back to your excel worksheet. Go to cell A4 (or another empty cell, if you want to put the data elsewhere), and then select “Edit” from the menu bar. Select “Paste Special” and then “Text” from the popup box. Click “OK”. The data should appear in your Excel worksheet just as it does above.

Sales | |

Salesman A | 87925 |

Salesman B | 100000 |

Salesman C | 145000 |

Salesman D | 200750 |

Salesman E | 178650 |

Salesman F | 99555 |

Salesman G | 147000 |

Salesman H | 213450 |

Salesman I | 122680 |

Salesman J | 92500 |

Ok, now back to the tutorial.

Next, suppose that you give them a bonus commission of 12% if they’ve exceeded a threshold value, say, $100K. Rather than going through each sales figure yourself and manually checking to see if that number is greater than $100K, and if so, calculating the commissions in another column (column C in this case), you can use the IF function to do this for you.

First, let’s put the 12% commission percentage in B1 so we can change it later if we want to, and the $100K figure in B2 for the same reason:

Here’s the syntax for the IF statement in Excel. You put the function in the cell or cells where you want the result. The IF function takes three inputs:

**=IF(condition to test for, what to do if the condition is true, what to do if the condition is NOT true)**

The first two arguments are required, and the last one is optional. If you leave out the part about what to do if the condition isn’t true, then Excel will return “FALSE” automatically. This can be useful in certain situations. In our case, just to avoid confusion, we’ll put in a specific action for what to do when the condition is not true.

So, in our case, we’d start in cell C5, where we want to calculate the salesman’s bonus, if any. The IF statement would be written as.

**=IF(B5>$B$2, B5*$B$1, “No bonus”)**

Like this:

Here’s what that says in plain English: If the number in cell B4 is greater than the number in cell B2, then multiply B4 by B1. If not, then write “No bonus” in the cell instead. Once you enter in this formula, the result will be printed in the cell. In this case, Salesman A didn’t make enough sales, so “No bonus” appears in the cell.

By the way, the dollar signs by $B$2 and $B$1 are simply an ugly way that Excel uses to keep a cell “fixed”. Later on, we’ll copy and paste the IF function we wrote in cell C4 and the formula will automatically adjust for each row. For example, if we paste the formula in cell C6, the formula will automatically change to:

**=IF(B6>$B$2, B6*$B$1, “No bonus”)**

If we hadn’t put “$” by B2 and B1, then these would have automatically adjusted as well when we pasted the formula in another cell. Of course, you could avoid all this and put 100,000 and 12% into the IF statement directly, but if you needed to change these parameters later on, it’d be much harder to do.

After copying and pasting the IF formula down the column, here’s our result:

And voilá. It’s done. Now you can format all the numbers and alignments nicely so it’s more readable.

If you have several rows of data, the IF statement is a lot easier a tool to use than going through each case manually! In an upcoming post, I’ll try to describe some other nifty things you can do with the IF statement.

***************************************************

**Look Good at Work and Become Indispensable Become an Excel Pro and Impress Your Boss**

***************************************************

## George Gray

C40 =IF(D391000000,1000000,D39)

If Cash available in C39 is less than $0 spend nothing but if C39 is between 0 & 1000000 use the amount in C39 if over 1M only use 1M

## kat

I am learning excel and need help with this question

Bonuses are calculated based on two criteria. 1. They have to have met

the target of $20K in each month in order to qualify. Cumulative does not count.

It’s not $40 for both months. Anything less than $20k in any month disqualifies

for from any bonus. Then if they meet the criteria the bonus is calculated at

the tiers shown. Of course anything less than $40k get nothing but you have to

calculate the right percentage for the total of both months for each qualifying

person.

Employee January February Bonus

Smith, Joe $9,286.78 $26,531.88

Jones, David $26,432.03 $31,028.46

Doe, Jack $20,587.52 $32,057.38

Blank, Pat $19,071.14 $25,472.54

Orlando, Grace $20,668.00 $25,485.13

Davey, Laurie $17,044.13 $24,422.06

Leal, Jean $19,238.26 $22,891.51

Rodgers, Richard $28,062.67 $14,415.38

Scaggs, Chris $23,087.47 $21,801.39

Owen, Vicky $26,521.91 $19,193.79

Walsh, Margaret $23,470.40 $25,340.72

Palmer, Ben $32,802.33 $21,764.91

Adams, Tom $21,965.45 $26,465.77

Post, Mark $21,966.63 $18,856.54

Russ, Ola $17,346.49 $9,736.54

Bonus Totals $-

Monthly Target $20,000.00

Bonus Tiers

Up to $40,000.00 0

Up to $50,000.00 5%

Up to $60,000.00 10%

Over $60,000.00 15%

## shenny

Please help with excel if function on how to find recommendation using the ff ex…

SPH HOURS QA Recommendation

0.08 40 75%

Use the word “Full Pass” if the Agent was able to meet all three targets (SPH, HOURS and QA).

Use the word “EOC” if the Agent did not meet all three target.

Thank you.This is new to me

I’m getting error with the formula I used.

## CatFox

I am trying to write this to excel…

If F12=NameHere then Yes if not then No I have tried and tried and now I need someone to help me

## Boyd Mooso

Kat, yours is just like the original example.

Catfox, what are you asking?

## Lorraine Ryan

Help please with the following:

Contents of cell E4 is Time Taken for Deliveries in hours i.e. 52, 63, 11, etc

Question as follows:

Accommodation is not paid for when the journey is less then 8 hours,

When a journey is greater than 8 hours but less then or equal to 20 hours, one nights accommation is paid at a rate of €79

If the journey takes between 21 and 40 hours then accommodation costa re paid at a rate of €150

When the journey takes longer than 40 hours a lump sum of €250 is paid

## Ejay

very helpful. I’m working my wife’s assignment about worksheet., now I’m done! thanks a lot….

## Sharalee

You have just saved the day thank you so much! I was going insane trying to finish an assignment on IF functions for University and could not for the life of me get it to work, but thanks to this page I can now say I DID IT and best of all the formula’s worked!

## JIM

i like use if statment

coln if coln f3>g3 then answer should be in red font

if g3>f3 then answer should be in black font

please help me

## JIM

i like to use if statment saying

=$f3>g3 then answer should in red color font, otherwise black

can you please formate this formula

## Daniel

I am wanting to use an “if statement” to count the number of days sales for “Item 1” or “Item 2” that are above $100. How would I write this formula?

## jody

All full-time (FT) employees are eligible for a bonus. Pay Grade A employees receive $3,000 (cell X2), Pay Grade B employees receive $6,000 (cell X3), and Pay Grade C employees receive $8,000 (cell X4). In the Bonus Amount column, enter nested IF functions to calculate the bonus. For employees not eligible for a bonus, display the text NE.

I need help please, I’ve tried everything but nothing works, I’m having a hard time understanding nested if functions. Thank you.

## Moya

I am trying to do this formula but I am having some difficulty. NEED some help.

For every 5 hours, you get $500*(30/100). I was using (INT(S3/5)*500)*1.3, with decimal but I changed it over to time eg. (fr 5.3 to 5:30) and the formula stops working. Could someone please help me on this please? Would appreciate this so much.

## anam

Great help, thanks :)

## Ifeanyi

How do I design an excell template that calculates due date based on account credit and balance?

Eg, when will an account credited with $3000 expire (ie with exact expected date for account to be replenishes)

## debanjana

Hi. actly i want to know the formula of IF which i need to create in my salary slab of P.tax which automatically calculates when i put the next salary slab so please help me . My salary slab is 0-8500- 0,8501-10000-90,10001-15000-110,15001-25000-130,25001-40000-150, above 40000 is 200 so what will be the condition of IF

## YUKATHARSA

GOOG ANSWER

## YUKATHARSA

Good answer

## YUKATHARSAN

but this answer good,please tell mor if question and answer.

## YUKATHARSAN

please tell me excel bonus farmulas and examle

## dirty harry

how would I do this. if checking balance is less than 250, put in low. if its between 250, but less than 2000, put medium. and high otherwise

## Philip Morris

I’ve been tasked with doing a spreadsheet for stock levels, i was hoping someone would be able to help with a formula. I have 3 fields that I need to interact with each other if possible they are Qty, Qty Used and Running Total. I was wanting what ever is entered in the Qty Used field to be deducted from the Qty field and added to the Running Total field but then I also wanted the Qty Used field to rest to zero. Is any of this even possible, Many Thanks

## Please Leave a Comment!