Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
parentheses
From one excel novice to all you excel brain boxes can any of you give
me some tips on when and where I should be putting parentheses after the = sign when writing a formula or direct me to any good articles explaining so in an idiots guide if possible. Thank you |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
parentheses
"Brendy" wrote:
can any of you give me some tips on when and where I should be putting parentheses after the = sign when writing a formula or direct me to any good articles explaining so in an idiots guide if possible. I presume you are asking about parentheses in arithmetic expressions (like 2 + 5*6), not functions. For the latter, you put parentheses exactly where the syntax requires it. Consult the function Help page. For expressions, go to Help Excel Help, search for "precedence", select "About calculation operators", and select "The order in which Excel performs operations" for an explanation. I prefer to minimize the use of parentheses, relying on operator precedence. Other people prefer to maximize the use of parentheses when mixing operators. So I might write 5 + 6*7 to mean 5 + 42, whereas others might prefer 5 + (6*7), even though the parentheses are superfluous in that case. On the other hand, parentheses would be required if I meant 11 * 7 -- that is, (5 + 6)*7. Hope that helps. If you want to know about parentheses in other contexts, provide specific examples. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
parentheses
Thanks for your reply what a mean is when writing formulas that use
different functions and are nested, in what order should I use to put these ( ) Eg =sum(a1:a4) I can understand but sometimes when creating a formula 2 (( or 3((( are after the first function in the formula. what I want to know is there a simplier way of knowing if these double or treble parentheses should be put at the start or end of the formula. Hope I have explained myself a little better |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
parentheses
Brendy,
joeu2004 indicated how parentheses are used to change the order of calculation. In Excel the order that calculations are carried out is not from left to right but it first of all raises numbers to a power, then multiplies and divides then finally adds and subtracts *REGARDLESS* of what order they are laid out in. (Check Help for information on the order of calculation) For instance with 1,2 & 3 in A1:A3 respectively if you wanted to add all three together, multiply the answer by 5, add two to the result and then multiply the whole answer by 3 and you used the formula: =A1+A2+A3*5+2*3 it would return a wrong answer (24) because it would first of all multiply A3 by 5 and 2 by 3, add them together and then add A1 & A2 which is not what we wanted. To make sure that it added A1, A2 & A3 together first we have to enclose them in parentheses: =(A1+A2+A3)*5+2*3 This will still give a wrong answer because although it will now add A1, A2 & A3 together before it uses the answer in the rest of the formula, it will also multiply the 2 & 3 together which is not what we want. We therefore have to add another set of parentheses: =((A1+A2+A3)*5+2)*3 this will now return the correct result (96) but you may prefer to make it more obvious that the 2 is only added after the three cells are added together and multiplied by 5: =(((A1+A2+A3)*5)+2)*3 this last set of parentheses is not strictly required and makes no difference to the formula result but I am just using it for this illustration. We thus have a formula starting off with three parentheses. QED When I first started writing formulas I would sometimes join up the top and bottom ends of the parentheses to make oval shapes. Starting from the inner most set you should end up with sets of ovals that never cross over one another. If they ever do cross then you have a mistake somewhere. -- HTH Sandy with @tiscali.co.uk "Brendy" wrote in message oups.com... Thanks for your reply what a mean is when writing formulas that use different functions and are nested, in what order should I use to put these ( ) Eg =sum(a1:a4) I can understand but sometimes when creating a formula 2 (( or 3((( are after the first function in the formula. what I want to know is there a simplier way of knowing if these double or treble parentheses should be put at the start or end of the formula. Hope I have explained myself a little better |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
parentheses
"Brendy" wrote:
what a mean is when writing formulas that use different functions and are nested, in what order should I use to put these ( )[.] Eg =sum(a1:a4) I can understand but sometimes when creating a formula 2 (( or 3((( are after the first function in the formula. what I want to know is there a simplier way of knowing if these double or treble parentheses should be put at the start or end of the formula. Hope I have explained myself a little better I'm not sure. But with nested functions (and nested expressions), the simple rule is: you balance parentheses as needed. Consider an example of nested IF() functions in the false-part. =IF(A10, ..., IF(B10, ..., IF(C10, ...) ) ) I have 3 parentheses at the end, not because of any arbitrary rule about multiple parentheses, but because each IF() requires a pair of parentheses as follows: IF(A10, ..., ...) IF(B10, ..., ...) IF(C10, ..., ...) It is merely "coincidence" that all 3 right parentheses -- one for each IF() function -- occur next to each other. To make that point clear, consider the case where those nested IF() functions are in the true-part: =IF(A10, IF(B10, IF(C10, ..., ...), ...), ...) As for multiple parentheses at the start of a function, again it is merely coincidence. Consider the following: =IF(((A1+A2)/A3 + A4)*A5 0, ..., ...) The 3 initial parentheses appear together, again not because of any arbitrary rule about multiple parenthese, but simply because of the need to groups subexpressions as follows: IF(..., ..., ...) (... + A4)*A5 (A1+A2)/A3 If I turn the conditional expression around, there would be only one left parenthesis at the start of the IF() function, viz: IF(0 < ((A1+A2)/A3 + A4)*A5, ..., ...) The bottom line is: don't think of this as a rule for when multiple parentheses are required; think only of balancing left and right parentheses for each subexpression and function. Does that help? |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
parentheses
Thank you Joe and Sandy, your patience with me is appreciated, what you
both say makes sense and have learnt a little, the best way forward is by trial and error and studying the Microsoft Help Thanks again Brendan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I produce a number in parentheses? | Excel Discussion (Misc queries) | |||
Why cant you show negative numbers in parentheses? | Excel Discussion (Misc queries) | |||
How can I get negative percentages with parentheses? | Excel Discussion (Misc queries) | |||
What is the keyboard shortcut for parentheses? | Excel Worksheet Functions | |||
Removing parentheses | Excel Worksheet Functions |