A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Use of Parntheses in Expressions



 
 
Thread Tools Display Modes
  #1  
Old June 7th, 2010, 12:49 AM posted to microsoft.public.access.queries
BBAL20
external usenet poster
 
Posts: 38
Default Use of Parntheses in Expressions

Hello,

I am fairly new to Access and Excel. I am trying to write a
formula/expression, but I think my problem is as simple as having the
parenthese in the wrong place. The formula I have currently is as follows:

Sum(((IIf([Mapping]![Pricing]="CPM",[TPImpressions]/1000*[Mapping]![Price],IIf([Mapping]![Pricing]="CPC",[TPClicks]*[Mapping]![Price],[TPConv]*[Mapping]![Price]))))*[Mapping]![Eye Engage Cost])))))

I basically want the SUM(IF part to be evaluated first and then multiply the
result by [Mapping]![Eye Engage Cost] at the end. Currently, the formula
above returns the value in the Sum(IF, but doesn't mulitply by the Eye Engage
Cost.

Also, can anyone reccomend a website or good reference materail that will
help me understand how parentheses work in Nested Formulas other than knowing
that the innner most parentheses is always evaluated first?
--
Thank you for your help and support
  #2  
Old June 7th, 2010, 04:02 AM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Use of Parntheses in Expressions

Try this --
Sum(IIf([Mapping].[Pricing]="CPM",[TPImpressions]/1000*[Mapping].[Price],IIf([Mapping].[Pricing]="CPC",[TPClicks]*[Mapping].[Price],[TPConv]*[Mapping].[Price])))*[Mapping].[Eye Engage Cost]

--
Build a little, test a little.


"bbal20" wrote:

Hello,

I am fairly new to Access and Excel. I am trying to write a
formula/expression, but I think my problem is as simple as having the
parenthese in the wrong place. The formula I have currently is as follows:

Sum(((IIf([Mapping]![Pricing]="CPM",[TPImpressions]/1000*[Mapping]![Price],IIf([Mapping]![Pricing]="CPC",[TPClicks]*[Mapping]![Price],[TPConv]*[Mapping]![Price]))))*[Mapping]![Eye Engage Cost])))))

I basically want the SUM(IF part to be evaluated first and then multiply the
result by [Mapping]![Eye Engage Cost] at the end. Currently, the formula
above returns the value in the Sum(IF, but doesn't mulitply by the Eye Engage
Cost.

Also, can anyone reccomend a website or good reference materail that will
help me understand how parentheses work in Nested Formulas other than knowing
that the innner most parentheses is always evaluated first?
--
Thank you for your help and support

  #3  
Old June 7th, 2010, 06:19 AM posted to microsoft.public.access.queries
BBAL20
external usenet poster
 
Posts: 38
Default Use of Parntheses in Expressions

The following gave me an error saying "You tried to execute a query that does
not include the specified expression"
--
Thank you for your help and support


"KARL DEWEY" wrote:

Try this --
Sum(IIf([Mapping].[Pricing]="CPM",[TPImpressions]/1000*[Mapping].[Price],IIf([Mapping].[Pricing]="CPC",[TPClicks]*[Mapping].[Price],[TPConv]*[Mapping].[Price])))*[Mapping].[Eye Engage Cost]

--
Build a little, test a little.


"bbal20" wrote:

Hello,

I am fairly new to Access and Excel. I am trying to write a
formula/expression, but I think my problem is as simple as having the
parenthese in the wrong place. The formula I have currently is as follows:

Sum(((IIf([Mapping]![Pricing]="CPM",[TPImpressions]/1000*[Mapping]![Price],IIf([Mapping]![Pricing]="CPC",[TPClicks]*[Mapping]![Price],[TPConv]*[Mapping]![Price]))))*[Mapping]![Eye Engage Cost])))))

I basically want the SUM(IF part to be evaluated first and then multiply the
result by [Mapping]![Eye Engage Cost] at the end. Currently, the formula
above returns the value in the Sum(IF, but doesn't mulitply by the Eye Engage
Cost.

Also, can anyone reccomend a website or good reference materail that will
help me understand how parentheses work in Nested Formulas other than knowing
that the innner most parentheses is always evaluated first?
--
Thank you for your help and support

  #4  
Old June 7th, 2010, 01:59 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Use of Parntheses in Expressions

Breaking that all down and formatting it for readability, I think you could
use the following expression.
Sum(
IIf(
[Mapping]![Pricing]="CPM",
[TPImpressions]/1000*[Mapping]![Price],
IIf(
[Mapping]![Pricing]="CPC",
[TPClicks]*[Mapping]![Price],
[TPConv]*[Mapping]![Price]
)
)
*[Mapping]![Eye Engage Cost]
)

If that errors, perhaps you could post the SQL statement of the query. (Menu -
View: SQL, copy and paste.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

bbal20 wrote:
Hello,

I am fairly new to Access and Excel. I am trying to write a
formula/expression, but I think my problem is as simple as having the
parenthese in the wrong place. The formula I have currently is as follows:

Sum(((IIf([Mapping]![Pricing]="CPM",[TPImpressions]/1000*[Mapping]![Price],IIf([Mapping]![Pricing]="CPC",[TPClicks]*[Mapping]![Price],[TPConv]*[Mapping]![Price]))))*[Mapping]![Eye Engage Cost])))))

I basically want the SUM(IF part to be evaluated first and then multiply the
result by [Mapping]![Eye Engage Cost] at the end. Currently, the formula
above returns the value in the Sum(IF, but doesn't mulitply by the Eye Engage
Cost.

Also, can anyone reccomend a website or good reference materail that will
help me understand how parentheses work in Nested Formulas other than knowing
that the innner most parentheses is always evaluated first?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:58 PM.


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