IIF Function

  • Thread starter Thread starter doodssa05
  • Start date Start date
D

doodssa05

Dear Sir,

I encounteretd problem regarding with my work and its difficult for me
to fidn the coorect syntax for this problem.

Here is the sample problem:

Side Order Value
Buy 25,000.00
Sell 24,250.00
Buy 23,200.00
Buy 500.00
Sell 20,210.00

Hence, in report I want to get the total Order value if the Side =
"Buy". Also, for Side = "Sell" to get the total Order Value.

Thank your very much in advance if you could give me an idea or the
correct syntax in my part.

Kind regards.
 
Create a query into this table.

Type this expression into a fresh column in the Field row:
BuyAmount: IIf([Side] = "Buy", [Order Value], 0)

In the next column, in the field row:
SellAmount: IIf([Side] = "Sell", [Order Value], 0)

You can now create a report with columns for BuyAmount and SellAmount, and
total the columns if desired.
 
Or just add a text box in a Group or Report Header or Footer with a control
source like:
=Sum(Abs([Side]="Buy") * [Order Value])
=Sum(Abs([Side]="Sell") * [Order Value])
--
Duane Hookom
MS Access MVP
--

Allen Browne said:
Create a query into this table.

Type this expression into a fresh column in the Field row:
BuyAmount: IIf([Side] = "Buy", [Order Value], 0)

In the next column, in the field row:
SellAmount: IIf([Side] = "Sell", [Order Value], 0)

You can now create a report with columns for BuyAmount and SellAmount, and
total the columns if desired.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Dear Sir,

I encounteretd problem regarding with my work and its difficult for me
to fidn the coorect syntax for this problem.

Here is the sample problem:

Side Order Value
Buy 25,000.00
Sell 24,250.00
Buy 23,200.00
Buy 500.00
Sell 20,210.00

Hence, in report I want to get the total Order value if the Side =
"Buy". Also, for Side = "Sell" to get the total Order Value.

Thank your very much in advance if you could give me an idea or the
correct syntax in my part.

Kind regards.
 
Back
Top