Remove Last 3 Characters from field - results in invalid procedure error

lefty38

Board Regular
Joined
Oct 27, 2005
Messages
85
in a query I am trying to remove the last 3 characters in a result set

NewField: LEFT([JOB_TITLE],LEN([JOB_TITLE])-3)

but keeps on getting "Invalid Procedure Call"

is it the expression above ? or is it something else?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
it's seems you tried with table.

try like this ..
Code:
 =LEFT(Table1[[#This Row],[FilmNAme]],LEN(Table1[[#This Row],[FilmNAme]])-3)
 
Upvote 0
it's seems you tried with table.

try like this ..
Code:
 =LEFT(Table1[[#This Row],[FilmNAme]],LEN(Table1[[#This Row],[FilmNAme]])-3)

my bad I thought it was for excel table.

I think you should include table name as well like this..Expr1: Left([customers].[Company],Len([customers].[Company])-3)
 
Upvote 0
I did, but I edited it for the post

JobTitle: LEFT(
.[JOB_TITLE],LEN(
.[JOB_TITLE])-3)

i will double check tommorrow at work
 
Upvote 0
are you sure
.[JOB_TITLE] is always longer than 3 characters ?

that should fail if its shorter than 4 or if its blank or if its null
 
Upvote 0
I will check when I get back to work
it seems to process then fails when data is returning
 
Upvote 0
All - yes there was a value with a blank cell

so I guess how do you convert this expression to check for and exclude null values?

JobTitle: LEFT(
.[JOB_TITLE],LEN(
.[JOB_TITLE])-3)
 
Upvote 0
You can use an IIF statement to check to see if the length is greater than 3, i.e.
Code:
[COLOR=#333333]IIF([/COLOR][COLOR=#333333]LEN([table].[JOB_TITLE])>3,[/COLOR][COLOR=#333333]LEFT([table].[JOB_TITLE],LEN([table].[JOB_TITLE])-3,"")[/COLOR]
 
Upvote 0
IIF() might still fail because IIF() evaluates all arguments (no short-circuit evaluation).

Lacking context, possibly (using three spaces between the quotes):
Trim(Left("   " & [Job_Title], 3))

Or perhaps if you are able, create and use job title ID as a way to keep the data cleaner.

Note: Disregard. Bleh.

-----

Okay, meant this:
Trim(Left([Job_Title] & "   ", 3))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,714
Messages
6,161,467
Members
451,708
Latest member
PedroMoss2268

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top