IIF formula

  • Thread starter Thread starter hermie
  • Start date Start date
H

hermie

If have the next IIF formula
=IIf(IsNull([porhora]),[mensual],IIf(IsNull([porhora]),[salario_otro],[porho
ra]))

This formula works, it shows the fields porhora and mensual but not the
field salario_otro?

What is wrong in the formula that it not shows the field salario_otro?
 
Hermie,

What are you trying to achieve? The way your formula is, if porhora is ideed
null it will return mensual; if it is not, it will return the result of the
inner IIf, and because porhora is not null, that will naturally be porhora.
Describe in words what you want returned when porhora is null, and what if
not.

Nikos
 
The IIF has three parts: the boolean expression, the true part and the false
part. In your statement, if porhora is null, the true part ([menual]) gets
done. If porhora isn't null, it evaluates the second IIf statement. Since it
only evaluates the second statement if porhora isn't null, it'll always do
the last part.
 
I have 3 field porhora(number), mensual(number) and Salario_otro(text)

I want to generate a list with the conditions as mentioned in the formula.
example of ouput:

herman $5.15
Ivan $6.00
Jan $ 1155.00
Isaac Commission

Hope I am more clear now?

Herman

Nikos Yannacopoulos said:
Hermie,

What are you trying to achieve? The way your formula is, if porhora is ideed
null it will return mensual; if it is not, it will return the result of the
inner IIf, and because porhora is not null, that will naturally be porhora.
Describe in words what you want returned when porhora is null, and what if
not.

Nikos

hermie said:
If have the next IIF formula
=IIf(IsNull([porhora]),[mensual],IIf(IsNull([porhora]),[salario_otro],[porho
ra]))

This formula works, it shows the fields porhora and mensual but not the
field salario_otro?

What is wrong in the formula that it not shows the field salario_otro?
 
I have now the formula:

=IIf(IsNull([porhora]),[mensual],IIf(IsNull([salario_otro]),[porhora],[salar
io_otro]))

With the same problem!

How should the formula look like that it shows all 3 field?

Herman

Douglas J. Steele said:
The IIF has three parts: the boolean expression, the true part and the false
part. In your statement, if porhora is null, the true part ([menual]) gets
done. If porhora isn't null, it evaluates the second IIf statement. Since it
only evaluates the second statement if porhora isn't null, it'll always do
the last part.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



hermie said:
If have the next IIF formula
=IIf(IsNull([porhora]),[mensual],IIf(IsNull([porhora]),[salario_otro],[porho
ra]))

This formula works, it shows the fields porhora and mensual but not the
field salario_otro?

What is wrong in the formula that it not shows the field salario_otro?
 
You haven't clarified your logic as Nikos requested but my guess from
different combinations posted is:

= IIf(IsNull([porhora]),IIf(IsNull([mensual]),[salario_otro], [mensual]), _
[pohora])

HTH
Van T. Dinh
MVP (Access)
 
I explained the logic before I want to see the results of 3 field in 1
column

Your formula I tried out and works good, but I figured
it on another manner and works too.
=IIf(IsNull([porhora] Or
[salario_otro]),[mensual],IIf(IsNull([salario_otro]),[porhora],[salario_otro
]))

Thx anyway for your help

Hermie

Van T. Dinh said:
You haven't clarified your logic as Nikos requested but my guess from
different combinations posted is:

= IIf(IsNull([porhora]),IIf(IsNull([mensual]),[salario_otro], [mensual]), _
[pohora])

HTH
Van T. Dinh
MVP (Access)




hermie said:
I have 3 field porhora(number), mensual(number) and Salario_otro(text)

I want to generate a list with the conditions as mentioned in the formula.
example of ouput:

herman $5.15
Ivan $6.00
Jan $ 1155.00
Isaac Commission

Hope I am more clear now?

Herman
 
Back
Top