Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

CODES IN NOTES FIELD If then statement - then error

I'm not very good at doing any of this but I'm learing. I'm trying to decipher a from a list of 14 codes which get entered into a notes field. The codes are supposed to be the first items entered into the field but at times I've notice a space before they start the codes. I'm trying to find where all the errors are in the fields when the users enter the incorrect codes. The reason is im' trying to create groups for these specific codes only but keep getting other codes because they aren't entered correctly. I have started what I thought would work and it does for the first code and if I stop there the formula works fine, but I need the other 13 to work as well. Any ideas. I keep getting a "The keyword 'then' is missing in the below formula. I know I'm obviously doing something wrong but I don't know what?

IF Left({View_RscMaster_History.Staffing_Note_Vc},2 ) = "MS" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},3 ) = "CAR" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},4 ) = "CMTE" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},4 ) = "SPEC" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},4 ) = "BFHM" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},4 ) = "INST" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},5 ) = "BFPAR" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},5 ) = "BFSCH" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},5 ) = "EVENT" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},5 ) = "NREMT" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},5 ) = "HMSCH" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},6 ) = "FRSTYR" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},7 ) = "FIREINV" or
IF Left({View_RscMaster_History.Staffing_Note_Vc},7 ) = "CPRINST" then "" else  "WRONG CODE"
0
RandyMFire
Asked:
RandyMFire
1 Solution
 
peter57rCommented:
Remove all the 'IF's except the first one.
0
 
RandyMFireAuthor Commented:
Thanks. That was it.
0
 
mlmccCommented:
If there are leading spaces you could use TRIM or LTRIM to remove them before testing

mlmcc
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now