We saw in the last lesson that when you click on an Excel cell, you can edit it. Any text that starts with "=" will make Excel interpret the text as code.To start writing code in Excel, we first need to understand the program's language. Let's now look at its operators:Arithmetic OperatorsPlus sign ( + ) Addition 5+5Minus sign ( - ) Subtraction 5-4Asterisk ( ) Multiplication 44Division sign ( / ) Division 8/8Percentage sign ( % ) Percentage 15%Caret ( ^ ) Exponentiation 6^2Examples= 3 + 2 ---> will return 5= 2 - 1 ----> will return 1= 2 * 3 ------> will return 6= 4 / 2 -----> will return 2= 15% -----> will return 0.15= 3 ^ 2 -----> will return 9= 9 ^(1/2) ---> will return 3. The exponent of a division is the same as the root of the divisor.Signs and What They IndicateCriterionOperatorGreater than>Less than<Equal to=Not equal to<>Greater than or equal to>=Less than or equal to<=Examples= 3<>2 ---> will return true= 2 > 1 ----> will return true= 2 < 1 ------> will return false=1 <= 1 -----> will return true= 2 >= 1 -----> will return trueOperator PrecedenceExcel, like most of us Brazilian humans, reads from left to right. In addition, it gives preference to calculations in the following order:1. Inside parentheses2. Root or power3. Multiplication or division4. Addition or subtraction.Example\[ (80 - 2) · 4 - (10 + (40 + 10/2)) \]First, it will solve the innermost parentheses: (40 + 10/2). Right after that, since there is no root or power, it will solve the division 10/2, which is equal to 5. So we will have: (40 + 5) = 45.Once the innermost parentheses have been solved, we move on to the following ones. The formula is currently: = (80 - 2) · 4 - (10 + 45). Excel will now solve the leftmost parentheses: (80 - 2) = 78. Then it will solve: (10 + 45) = 55.Now we have the following equation: 78 · 4 - 55. Since there are no more parentheses, no root, and no power, it will solve the multiplication first: 78 · 4 = 312.The equation is now: 312 - 55. Solving it, we end up with 257 as the answer.Exercises1. Type the following expressions in Excel and see if you get the answer:2. Solve each expression below and check whether it is true or false:3. Write a formula in Excel that calculates the average of three numbers (5, 10, 15) and checks whether the average is greater than 10.4. Write a formula in Excel that calculates the sum of two numbers (8 and 12) and checks whether the sum is less than or equal to 20.5. Write a formula in Excel that calculates the product of two numbers (4 and 5) and checks whether the product is different from 20.6. Suppose the price of a product is in cell A1 and the discount (as a percentage) is in cell B1. Write a formula in Excel that calculates the final price after the discount.7. Suppose you have an initial value in cell A1, an interest rate in cell B1, and a number of periods in cell C1. Write a formula in Excel that calculates the future value with compound interest.8. Given a number in cell A1, write a formula that returns 1 if the number is positive and 0 if it is negative.9. Given three sides of a triangle in cells A1, B1, and C1, write a formula that returns 1 if the sides form a valid triangle and 0 otherwise.Answer Key2.a) Falseb) Falsec) Falsed) Truee) Falsef) Trueg) Falseh) Truei) True
— commentaires 0
, Réactions 1
Soyez le premier à commenter