#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Brendy
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Brendy
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sandy Mann
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Brendy
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I produce a number in parentheses? CLR Excel Discussion (Misc queries) 5 June 8th 06 06:17 AM
Why cant you show negative numbers in parentheses? Bruce Excel Discussion (Misc queries) 5 December 6th 05 04:26 PM
How can I get negative percentages with parentheses? dcoffman32 Excel Discussion (Misc queries) 4 November 4th 05 01:13 AM
What is the keyboard shortcut for parentheses? jstewart46 Excel Worksheet Functions 8 March 8th 05 06:59 PM
Removing parentheses Brett Excel Worksheet Functions 6 February 9th 05 04:46 PM


All times are GMT +1. The time now is 11:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"