# Nest a function within a function

When you create a formula by using a function, you can nest functions inside other functions. When you do, you're using the results of the nested functions as arguments— pieces of data the first function needs to run properly. You can always tell when a function is nested because it's inside parentheses.

Here's an example. The IF function uses nested AVERAGE and SUM functions as arguments.

=IF(AVERAGE(F2:F5)>50,SUM(G2:G5),0)

You can read this formula from left to right. IF the average value of cells F2 to F5 is greater than 50, then SUM the values in cells G2 through G5. Otherwise, return 0.

You can nest up to 64 levels of functions, and you enter them like any other function:

1. Click the cell that will hold the formula.

2. Enter the formula in the formula bar and press Enter.

Here's another example. This one nests an IF function inside another IF function to calculate deductions based on income level.

=IF(A5<31500,A5*15%,IF(A5<72500,A5*25%,A5*28%))

You can also read this example from left to right. IF the value in cell A5 is less than 31,500, then multiply the value by 15%. But IF it's not, check to see if the value is less than 72,500. IF it is, multiply by 25%, otherwise multiply by 28%.

Note that the income levels don't use commas. If they did, the IF function would try to use them as arguments and the formula would break.

Connect with an expert