+ Start a Discussion
Athira VenugopalAthira Venugopal 

"Error: Syntax error. Missing ')' for Case Statement in formula

I've created a text formula field, but I've been hitting a wall with the CASE portion of the formula: I keep getting the "Error: Syntax error. Missing ')'" message. Here's what I created:

CASE(TEXT(Base_Unit_Volume_UOM__c),
"Blank", "Blank",
"IN", "Inches",
"LB",    "Pounds",
"LT",    "Liters",
"BT",    "Bottles",
"CS",    "Case",
"KE",    "Keg",
"BD",    "Bladder",
"12",    "Twelve Pack",
"BL",    "Barrels",
"BX",    "Box",
"PL",    "Pallet",
"SX",    "Six Pack",
"TK",    "Tank",
"TM",    "Metric Ton",
"TN",    "Ton (US)",
"%",    "Percent",
"AS",    "Annual Salary(rounded)xmult. PayRoll System",
"AT",    "Annual Salary(truncated)xmult. PayRoll System",
"BA",    "Bar Absolute (Pressure)",
"BC",    "Bag",
"BG",    "Bar Gauge (Pressure)",
"BK",    "Bucket",
"BU",    "Bushel",
"C1",    "20 FEET CONTAINER",
"CC",    "Cubic Centimeter",
"CF",    "Hundred Feet",
"CI","Cubic Inches",
"CL",    "Centiliters",
"CM",    "Centimeters",
"CN",    "Can",
"CR",    "Carton",
"CT",    "Carat",
"CU",    "Cubic Meter",
"CW",    "Hundredweight",
"CY",    "Cubic Yard",
"DC",    "Decimeters",
"DL",    "Deciliter",
"DR",    "drums",
"DW",    "Penny Weight",
"DY",    "Days",
"DZ",    "Dozen",
"EA",    "Each",
"FC",    "Cubic Feet",
"FF",    "Feet/Inches/16th",
"FO",    "Fluid Ounce",
"FT",    "Feet",
"G1",    "100 Gallons",
"GA",    "Gallons",
"GJ",    "Giga Joule",
"GM",    "Grams",
"GP",    "Potent Gallons",
"GR",    "Gross",
"H1",    "Half Hour Calculations",
"HA",    "Average Hourly Rate",
"HE",    "Head Count",
"HH",    "Hours X Hours Worked",
"HL",    "Hectoliter",
"HQ",    "Hours per period (zero $)",
"HR",    "Hour",
"HT",    "Hectare",
"HZ",    "Hours x Hrs worked (zero $)",
"IG",    "Imperial Gallons",
"KG",    "Kilograms",
"KL",    "Kiloliter",
"KM",    "Kilometers",
"KT",    "Karat",
"KW",    "Kilowatt Hour",
"L3",    "Pounds per square inch",
"LC",    "Cubic Liters",
"LF",    "Linear Feet",
"LG",    "Log"
"LP",    "Potent Liters",
"LS",    "Lump Sum",
"LY",    "Layer",
"M3",    "Cubic Meters",
"MF",    "Thousand Feet",
"MG","Milligrams",
"MH",    "Man Hour",
"MI",    "Miles",
"MK",    "Micrograms",
"ML",    "Milliliter",
"MM",    "Millimeters .",
"MN",    "Minutes",
"MO",    "Months",
"MP",    "Thousand Pieces",
"MS",    "Thousand Square Feet",
"MT",    "Meters",
"MW",    "Thousand Pounds",
"OP",    "Potent Ounces",
"OT",    "Troy Ounces",
"OZ",    "Ounces",
"PC",    "Pieces",
"PD",    "Pad",
"PG",    "Proof Gallon",
"PK",    "Inner Pack",
"PR",    "Proof Liters",
"PT",    "Pint",
"PY",    "Pallet Layer",
"QT",    "Quart",
"RL",    "Roll",
"RM",    "Ream",
"RT",    "$1000s of Salary",
"SC",    "Square Centimeters",
"SE",    "Seconds",
"SF",    "Square Feet",
"SI",    "Square Inches",
"SK",    "Skein",
"SL",    "Sleeve",
"SM",    "Square Meters",
"SP",    "Spaces",
"SY",    "Square Yard",
"TL",    "Long Ton (English)",
"TS",    "Short Ton (U.S.)",
"UN",    "Units",
"WK",    "Weeks",
"WU",    "Weld Units",
"XL",    "Excess Life",
"YD",    "Yards",
"YR",    "Year",
"Z",    "Set (3-PW)",
"")

I tried this in a workflow field update. Everything seems to be in order, but I cannot figure out what's missing. Any help here would be greatly appreciated!

User-added image
AbhinavAbhinav (Salesforce Developers) 
Hi,

I would suggest check syntax first by adding few value .And then add value part by part with checking syntax.

Thanks!
Maharajan CMaharajan C
Hi Athira,

Comma is missing in below line. Just add the comma in end.
"LF",    "Linear Feet",
"LG",    "Log"         /// Comma is missing here 
"LP",    "Potent Liters",

It should be like below:
"LF",    "Linear Feet",
"LG",    "Log",
"LP",    "Potent Liters",

Thanks,
Maharajan.C
Suraj Tripathi 47Suraj Tripathi 47

Hi,

CASE(TEXT(Base_Unit_Volume_UOM__c),
"Blank", "Blank",
"IN", "Inches",
"LB",    "Pounds",
"LT",    "Liters",
"BT",    "Bottles",
"CS",    "Case",
"KE",    "Keg",
"BD",    "Bladder",
"12",    "Twelve Pack",
"BL",    "Barrels",
"BX",    "Box",
"PL",    "Pallet",
"SX",    "Six Pack",
"TK",    "Tank",
"TM",    "Metric Ton",
"TN",    "Ton (US)",
"%",    "Percent",
"AS",    "Annual Salary(rounded)xmult. PayRoll System",
"AT",    "Annual Salary(truncated)xmult. PayRoll System",
"BA",    "Bar Absolute (Pressure)",
"BC",    "Bag",
"BG",    "Bar Gauge (Pressure)",
"BK",    "Bucket",
"BU",    "Bushel",
"C1",    "20 FEET CONTAINER",
"CC",    "Cubic Centimeter",
"CF",    "Hundred Feet",
"CI","Cubic Inches",
"CL",    "Centiliters",
"CM",    "Centimeters",
"CN",    "Can",
"CR",    "Carton",
"CT",    "Carat",
"CU",    "Cubic Meter",
"CW",    "Hundredweight",
"CY",    "Cubic Yard",
"DC",    "Decimeters",
"DL",    "Deciliter",
"DR",    "drums",
"DW",    "Penny Weight",
"DY",    "Days",
"DZ",    "Dozen",
"EA",    "Each",
"FC",    "Cubic Feet",
"FF",    "Feet/Inches/16th",
"FO",    "Fluid Ounce",
"FT",    "Feet",
"G1",    "100 Gallons",
"GA",    "Gallons",
"GJ",    "Giga Joule",
"GM",    "Grams",
"GP",    "Potent Gallons",
"GR",    "Gross",
"H1",    "Half Hour Calculations",
"HA",    "Average Hourly Rate",
"HE",    "Head Count",
"HH",    "Hours X Hours Worked",
"HL",    "Hectoliter",
"HQ",    "Hours per period (zero $)",
"HR",    "Hour",
"HT",    "Hectare",
"HZ",    "Hours x Hrs worked (zero $)",
"IG",    "Imperial Gallons",
"KG",    "Kilograms",
"KL",    "Kiloliter",
"KM",    "Kilometers",
"KT",    "Karat",
"KW",    "Kilowatt Hour",
"L3",    "Pounds per square inch",
"LC",    "Cubic Liters",
"LF",    "Linear Feet",
"LG",    "Log"
"LP",    "Potent Liters",
"LS",    "Lump Sum",
"LY",    "Layer",
"M3",    "Cubic Meters",
"MF",    "Thousand Feet",
"MG","Milligrams",
"MH",    "Man Hour",
"MI",    "Miles",
"MK",    "Micrograms",
"ML",    "Milliliter",
"MM",    "Millimeters .",
"MN",    "Minutes",
"MO",    "Months",
"MP",    "Thousand Pieces",
"MS",    "Thousand Square Feet",
"MT",    "Meters",
"MW",    "Thousand Pounds",
"OP",    "Potent Ounces",
"OT",    "Troy Ounces",
"OZ",    "Ounces",
"PC",    "Pieces",
"PD",    "Pad",
"PG",    "Proof Gallon",
"PK",    "Inner Pack",
"PR",    "Proof Liters",
"PT",    "Pint",
"PY",    "Pallet Layer",
"QT",    "Quart",
"RL",    "Roll",
"RM",    "Ream",
"RT",    "$1000s of Salary",
"SC",    "Square Centimeters",
"SE",    "Seconds",
"SF",    "Square Feet",
"SI",    "Square Inches",
"SK",    "Skein",
"SL",    "Sleeve",
"SM",    "Square Meters",
"SP",    "Spaces",
"SY",    "Square Yard",
"TL",    "Long Ton (English)",
"TS",    "Short Ton (U.S.)",
"UN",    "Units",
"WK",    "Weeks",
"WU",    "Weld Units",
"XL",    "Excess Life",
"YD",    "Yards",
"YR",    "Year",
"Z",    "Set (3-PW)",
"")

please add comma 

"LF",    "Linear Feet",
"LG",    "Log",
"LP",    "Potent Liters",