Which function when entered into cell g7

The IFS function checks whether one or more conditions are met, and returns a value that corresponds to the first TRUE condition. IFS can take the place of multiple nested IF statements, and is much easier to read with multiple conditions.

Generally, the syntax for the IFS function is:

=IFS([Something is True1, Value if True1,Something is True2,Value if True2,Something is True3,Value if True3)


 

Please note that the IFS function allows you to test up to 127 different conditions. However, we don't recommend nesting too many conditions with IF or IFS statements. This is because multiple conditions need to be entered in the correct order, and can be very difficult to build, test and update.

Syntax

  • IFS(logical_test1, value_if_true1, [logical_test2, value_if_true2], [logical_test3, value_if_true3],…)

Argument

Description

logical_test1 (required)

Condition that evaluates to TRUE or FALSE.

value_if_true1 (required)

Result to be returned if logical_test1 evaluates to TRUE. Can be empty.

logical_test2…logical_test127 (optional)

Condition that evaluates to TRUE or FALSE.

value_if_true2…value_if_true127 (optional)

Result to be returned if logical_testN evaluates to TRUE. Each value_if_trueN corresponds with a condition logical_testN. Can be empty.

Which function when entered into cell g7

The formula for cells A2:A6 is:

  •  =IFS(A2>89,"A",A2>79,"B",A2>69,"C",A2>59,"D",TRUE,"F")

Which says IF(A2 is Greater Than 89, then return a "A", IF A2 is Greater Than 79, then return a "B", and so on and for all other values less than 59, return an "F").

Which function when entered into cell g7

The formula in cell G7 is:

  •  =IFS(F2=1,D2,F2=2,D3,F2=3,D4,F2=4,D5,F2=5,D6,F2=6,D7,F2=7,D8)

Which says IF(the value in cell F2 equals 1, then return the value in cell D2, IF the value in cell F2 equals 2, then return the value in cell D3, and so on, finally ending with the value in cell D8 if none of the other conditions are met).

  • To specify a default result, enter TRUE for your final logical_test argument. If none of the other conditions are met, the corresponding value will be returned. In Example 1, rows 6 and 7 (with the 58 grade) demonstrate this.

  •  If a logical_test argument is supplied without a corresponding value_if_true, this function shows a "You've entered too few arguments for this function" error message.

  •  If a logical_test argument is evaluated and resolves to a value other than TRUE or FALSE, this function returns a #VALUE! error.

  •  If no TRUE conditions are found, this function returns #N/A error.

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

IF function
Advanced IF functions - Working with nested formulas and avoiding pitfalls
Training videos: Advanced IF functions
The COUNTIF function will count values based on a single criteria
The COUNTIFS function will count values based on multiple criteria
The SUMIF function will sum values based on a single criteria
The SUMIFS function will sum values based on multiple criteria
AND function
OR function
VLOOKUP function
Overview of formulas in Excel
How to avoid broken formulas
Detect errors in formulas
Logical functions
Excel functions (alphabetical)
Excel functions (by category)

Formulas in Excel are basically mathematical expressions that use cell references (e.g., “A5”,” D17”) as arguments.  For example, a formula that adds the contents of cell E5 and E6 could be written as follows:

= E5+E6

(Note: all formulas in Excel need to be preceded by an “=” sign.) If the values contained in E5 and E6 are 6 and 11, respectively, the formula will produce 17 as the value it displays. If you change E5 to 7, the result will automatically change to 18.

Example

Let's say you were putting together an office supply order, and you wanted to keep track of much you were spending. You could put together a spreadsheet like the one below, with the list of items to be purchased, their unit prices, the number of each item ordered, and the total spent for each.  It would make sense to enter the things you know in advance (like the price of individual items and the number ordered), but you could let Excel calculate the totals for you.  For the first item listed below (pencils), this could be done by making the value of the total price (cell D2), the value of the unit price (held in cell C2) multiplied by the number of items ordered (held in D2).  This formula would be written "=B2*C2".

Which function when entered into cell g7

After hitting "Enter", the cell will display the calculated value, while the formula bar will still display the formula.  (Note: Always hit “Enter” when finished entering a formula, manually.  If you click off the cell, the cell you click to will be added to your formula.)

Which function when entered into cell g7

Excel will generally be able to handle any properly-input mathematical formula, if valid operators are used. Commonly used operators include "+" (addition), "-" (subtraction), "*" (multiplication) and "/" (division).  (Microsoft has a complete list of valid operators to be used in Excel formulas on the Office website).  Here are some examples of formulas using common operators:

Formula                                                                              Description

=C2-B2                                                                Subtracts contents of B2 from contents of C2

=C2/B2                                                                Divides contents of C2 by contents of B2

=(B2+C2+D2)/3                                                  Adds contents of B2, C2, and D2 and divides result by 3

Excel also has built-in functions that can do a lot of useful calculations.  These are most easily accessed by hitting the Insert Function button, which is represented by the “fx” symbol next to the formula bar.  For example, instead of entering the formula shown above, the same result could have been achieved using the built-in "PRODUCT" function by clicking in cell D2 and hitting the Insert Formula button.  This would give a dialog box like the one shown, below.

Which function when entered into cell g7

After selecting "PRODUCT" and clicking OK, you will get another dialog box, that allows you to select the cells to be multiplied.  You can do this for individual cells, by selecting cells separately in the "Number1" and  "Number2" boxes shown below, or by selecting an array of cells, by clicking and dragging on the range cells you want to use on the spreadsheet, itself.  (Note: if you try to enter a formula in a cell using the Insert Formula button and there are adjacent cells with numbers, Excel will often select those cells automatically, so make sure the cells selected in the dialog box are the correct ones.) 

Which function when entered into cell g7

Once you click "OK", your completed formula will be input into the cell.

Copying and pasting formulas

Often, you will need Excel to do a series of similar computations, where the only things that will change are the cells used as arguments.  For instance, in the example above, you would probably like Excel to calculate the Total Price for each item in the order.  You could re-input the same formula used to get the total price for pencils in each cell in that row, just changing the cells referenced (i.e. "=PRODUCT(B3:C3)", "=PRODUCT(B4:C4)", etc.), but Excel has simpler method for this. If you have multiple cells in the same row or column that need to do the same computation, you can simply copy the value in the cell you entered a formula, and then paste it into the subsequent cells.  Excel will then automatically adjust which cells are included in the formula, based upon which cell the formula was pasted to.  So, if the original formula entered in D2 was "=PRODUCT(B2:C2)", the formula pasted into D4 would be "=PRODUCT(B4:C4)"

More simply, if you have a formula you want repeated in a number of directly adjoining cells, you can just click and drag the bottom right corner of the cell with the original formula (see image below) onto the cells you want the same formula entered, and Excel will automatically copy and paste the formula for you, with appropriate adjustments made to the cell numbers in the formula.

Which function when entered into cell g7