IIf Statement

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

D

Hi:

I have two IIf statements; I did the split cause I could not get them into
one. I would please need jut one field called Value_Date.
Is there a way to consolidate them?

Thank you,

Dan

1. Value_Date: iif([P_Subtp] = "FWD" and [T_date]<[rpt_date],0,[T_date]
2. Value_Date1: iif([P_Subtp] <> "FWD" and [S_date]<[rpt_date],0,[S_date]
 
Value_Date: iif([P_Subtp] =
"FWD",iif([T_date]<[rpt_date],0,[T_date]),iif([S_date]<[rpt_date],0,[S_date]))
 
In fact, if that should return one value_date, that makes 3 cases:

case 1: NOT( [P_Subtp] = "FWD" and [T_date]<[rpt_date] )
return T_date
case 2: NOT( [P_Subtp] <> "FWD" and [S_date]<[rpt_date] )
return S_date
case else:
return 0


so:


Value_Date: Switch(
NOT( [P_Subtp] = "FWD" and [T_date]<[rpt_date] ) , T_date,
NOT( [P_Subtp] <> "FWD" and [S_date]<[rpt_date] ), S_date,
true, 0 )



Vanderghast, Access MVP
 
Would that take in consideration when [P_subtp]<> "FWD"

Thank you Ronaldo!



RonaldoOneNil said:
Value_Date: iif([P_Subtp] =
"FWD",iif([T_date]<[rpt_date],0,[T_date]),iif([S_date]<[rpt_date],0,[S_date]))

D said:
Hi:

I have two IIf statements; I did the split cause I could not get them into
one. I would please need jut one field called Value_Date.
Is there a way to consolidate them?

Thank you,

Dan

1. Value_Date: iif([P_Subtp] = "FWD" and [T_date]<[rpt_date],0,[T_date]
2. Value_Date1: iif([P_Subtp] <> "FWD" and [S_date]<[rpt_date],0,[S_date]
 
Yes, because the 3rd iif is the False part to the 1st iif - or in other
words when [P_subtp]<> "FWD"

D said:
Would that take in consideration when [P_subtp]<> "FWD"

Thank you Ronaldo!



RonaldoOneNil said:
Value_Date: iif([P_Subtp] =
"FWD",iif([T_date]<[rpt_date],0,[T_date]),iif([S_date]<[rpt_date],0,[S_date]))

D said:
Hi:

I have two IIf statements; I did the split cause I could not get them into
one. I would please need jut one field called Value_Date.
Is there a way to consolidate them?

Thank you,

Dan

1. Value_Date: iif([P_Subtp] = "FWD" and [T_date]<[rpt_date],0,[T_date]
2. Value_Date1: iif([P_Subtp] <> "FWD" and [S_date]<[rpt_date],0,[S_date]
 
Thanks a lot Michel!

I will try and let you know.

Thanks again,

Dan

Michel Walsh said:
In fact, if that should return one value_date, that makes 3 cases:

case 1: NOT( [P_Subtp] = "FWD" and [T_date]<[rpt_date] )
return T_date
case 2: NOT( [P_Subtp] <> "FWD" and [S_date]<[rpt_date] )
return S_date
case else:
return 0


so:


Value_Date: Switch(
NOT( [P_Subtp] = "FWD" and [T_date]<[rpt_date] ) , T_date,
NOT( [P_Subtp] <> "FWD" and [S_date]<[rpt_date] ), S_date,
true, 0 )



Vanderghast, Access MVP


D said:
Hi:

I have two IIf statements; I did the split cause I could not get them into
one. I would please need jut one field called Value_Date.
Is there a way to consolidate them?

Thank you,

Dan

1. Value_Date: iif([P_Subtp] = "FWD" and [T_date]<[rpt_date],0,[T_date]
2. Value_Date1: iif([P_Subtp] <> "FWD" and [S_date]<[rpt_date],0,[S_date]
 
Thank you very much, Ronaldo!

Dan

RonaldoOneNil said:
Yes, because the 3rd iif is the False part to the 1st iif - or in other
words when [P_subtp]<> "FWD"

D said:
Would that take in consideration when [P_subtp]<> "FWD"

Thank you Ronaldo!



RonaldoOneNil said:
Value_Date: iif([P_Subtp] =
"FWD",iif([T_date]<[rpt_date],0,[T_date]),iif([S_date]<[rpt_date],0,[S_date]))

:

Hi:

I have two IIf statements; I did the split cause I could not get them into
one. I would please need jut one field called Value_Date.
Is there a way to consolidate them?

Thank you,

Dan

1. Value_Date: iif([P_Subtp] = "FWD" and [T_date]<[rpt_date],0,[T_date]
2. Value_Date1: iif([P_Subtp] <> "FWD" and [S_date]<[rpt_date],0,[S_date]
 
Back
Top