Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF and Statement

Status
Not open for further replies.

TJVFree

Technical User
Nov 22, 2010
236
US
I'm working on a iif and statement that will turn the numbers in my ([OMNI_Status1]) from "9" to a 1, and if it’s not a "9" make it a "0"

I will also need to Trim the ([OMNI_Status1]) field

Below is what I thought would work but its either telling me that I have then wrong number of arguments, or giving me incorrect data or not working at all


Code:
Past_6_Full_Months: (IIf([CORRESPONDENT_PURCHASE_DATE] Between DateSerial(Year(Date()),Month(Date())-0,0) And DateSerial(Year(Date()),Month(Date())-6,1),and trim [OMNI_Status1]="9",1,0))

Thanks for taking the time to help
 
CoreyVI,

This is rather confusing. This appears to be the same question you asked in another thread.
When dhookum requested additional information, you replied you had found a solution.
If you're still having problems, why not provide the information dhookum asked for?


Randy
 
Randy, yes it is similar but I'm adding another step to the answer I already received.

The step I'm trying to add is "and trim [OMNI_Status1]="9",1,0))"

Looking for advice if I should be adding a and or a iif to add this part to my formula

DECamount: Sum(IIf([CORRESPONDENT_PURCHASE_DATE] Between DateSerial(Year(Date()),Month(Date())-1,0) And DateSerial(Year(Date()),Month(Date())-2,1),[Amount_Actual_Loan]))

Add to formula above “and trim [OMNI_Status1]="9",1,0))”

 
After reviewing the question again, please let me know if there is in fact the same question and that I should have stayed in the first form?

Thanks for taking your time to help
TCB
 

Try removing the comma before [red]and trim[/red].
Code:
Past_6_Full_Months: (IIf([CORRESPONDENT_PURCHASE_DATE] Between DateSerial(Year(Date()),Month(Date())-0,0) And DateSerial(Year(Date()),Month(Date())-6,1)and trim [OMNI_Status1]="9",1,0))


Randy
 
Thanks you Randy but that one didnt work, do you have any other ideas or advice?
 
Yes, a number of different ways, just couldn’t get it to work.

I think I might be able to get it to work doing this

Code:
Past_6_Full_Months: (IIf(([CORRESPONDENT_PURCHASE_DATE] Between DateAdd("m",-6,Date()) And Date()) And Trim([OMNI_Status1])="9",1,0))

just started working with it now. Thanks
 
I want able to get it to work!!

so now I'm trying to understand this formula. To be exact I'm trying to make this formula work as rolling months

I see that the DateAdd is looking back 6 months and the and Date()) is looking at today’s date. I need to be able to change this formula so I'm able to pull that date for January/ 13th month, Febuary/12th months and ect

I tried changing the And Date()) to And Date()-3 but couldn’t get it to work.

Code:
Past_6_Full_Months: (IIf(([CORRESPONDENT_PURCHASE_DATE] Between DateAdd("m",-6,Date()) And Date()) And Trim([OMNI_Status1])="9",1,0))

Iv been researching on line but cant fine what I’m looking for

Any advice is helpful.
Thanks
TCB
 

I think what Duane is trying to tell you is that TRIM only removes spaces, not other characters. How about this?
Code:
Past_6_Full_Months: (IIf([CORRESPONDENT_PURCHASE_DATE] Between DateSerial(Year(Date()),Month(Date())-0,0) And DateSerial(Year(Date()),Month(Date())-6,1)and [b][red]Left[/red][/b]([OMNI_Status1],1) = "9",1,0))
or this?
Code:
Past_6_Full_Months: (IIf([CORRESPONDENT_PURCHASE_DATE] Between DateSerial(Year(Date()),Month(Date())-0,0) And DateSerial(Year(Date()),Month(Date())-6,1)and [OMNI_Status1] [b][red]LIKE "*9*"[/red][/b],1,0))

Randy
 
Sorry it took me so long to get back to you, I got pulled into another project. I formula that Randy provided me worked great. Thank you both for your help

TCB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top