Running formulas from within an IF statement


I was wondering if it is possible to run a formula from within an IF statement. We have contact submission sheet we need to scrub and one of things that's messing with the process is from entries that have an extra space at the end of the values (For example "Bruce" and "Bruce ").

I have an column formula for an IF statement to identify which rows within a column have the extra space (=IF(RIGHT([First Name]@row, 1) = " ", 1, [First Name@row]) so I know that part functions, but what I'd like to do is set the formula so that: if the IF is true, it runs and returns LEFT([FirstName]@row, (LEN(CELLREFERENCE) - 1)) but if it is false then it just returns [First Name@row].

I tried it like this: "=IF(RIGHT([First Name]@row, 1) = " ", (LEFT([FirstName]@row, (LEN([FirstName]@row) - 1))), [First Name@row])" but it is returning an a message about a syntax error. I checked what can and cannot run as column formulas but I don't see where this breaks that (unless LEN only works as a specific cell reference).

Any and all help would be appreciated!

Best Answer