function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Huey Kein TanHuey Kein Tan 

Error: Incorrect parameter for function 'VLOOKUP()'.

Hi,

I am trying to use Vlookup() but keep getting error - Error: Incorrect parameter for function 'VLOOKUP()'.
i am using validation rule:
Expense_Total__c > VLOOKUP($ObjectType.Expense_Limit__c.Fields.Monthly_Expense_Limit__c, $ObjectType.Expense_Limit__c.Fields.Name, Role__c)

Rule is that total Expense must be less than or equal to user role's monthly expense limit.

Expense_Total_c is custom field (from roll up summary SUM)
$ObjectType.Expense_Limit__c.Fields.Monthly_Expense_Limit__c is field under an object (currency)
$ObjectType.Expense_Limit__c.Fields.Name is name field of record name (text 80)
Role__c is custom field (text 80) for user to key in role (i use formula $UserRole.Name also gives error when validate the formula)

I can't figure out where is wrong...anyone can help?
Best Answer chosen by Huey Kein Tan
Jason Curtis NBSFDGJason Curtis NBSFDG
The help for formula doesn't explicity say it can use currency,

https://help.salesforce.com/htviewhelpdoc?id=customize_functions_i_z.htm&siteLang=en_US#VLOOKUP (https://help.salesforce.com/htviewhelpdoc?id=customize_functions_i_z.htm&siteLang=en_US#VLOOKUP)

"The field_to_return must be an auto number, roll-up summary, lookup relationship, master-detail relationship, checkbox, date, date/time, email, number, percent, phone, picklist, text, text area, or URL field type."

I doubt that is it, though, but you could try making the field a straight number type.
I'll try to recreate this tonight and see what I can come up with.


All Answers

Jason Curtis NBSFDGJason Curtis NBSFDG
The help for formula doesn't explicity say it can use currency,

https://help.salesforce.com/htviewhelpdoc?id=customize_functions_i_z.htm&siteLang=en_US#VLOOKUP (https://help.salesforce.com/htviewhelpdoc?id=customize_functions_i_z.htm&siteLang=en_US#VLOOKUP)

"The field_to_return must be an auto number, roll-up summary, lookup relationship, master-detail relationship, checkbox, date, date/time, email, number, percent, phone, picklist, text, text area, or URL field type."

I doubt that is it, though, but you could try making the field a straight number type.
I'll try to recreate this tonight and see what I can come up with.


This was selected as the best answer
Huey Kein TanHuey Kein Tan
Thanks Jason, you are right! I changed it to "number" and it works. Thanks a lot.