Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
ani123

# Formula field

Hi can any one tell me how to write formula for merging four field names.

For ex:

Field 1

field 2

Field 3

Field 4

field1/field2/field3/field4

if any one of the field is empty like if field 2 is empty i want the formula field display as

field1/field3/field4

and not

field1//field3/field4

Navatar_DbSup

Hi,

Try the below formula for reference:

if( Field 1 !=null,Field 1+'/','') +
if( field 2 != null,field 2 +'/','') +
if( field 3 != null,field 3 +'/','') +
if( field 4 != null,field 4 +'/','')

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

ani123

Hi I have tried with that formula.(Number)Datatype .

Error: Incorrect parameter for operator '+'. Expected Number, Date, DateTime, received Text

Steve :-/

What are the datatypes of the 4 fields in your formula?

ani123

all the four fields are Number Field.

Steve :-/

Okay does a 0 count as a "blank" field or do you want to include them in your result?

ani123

i dont want 0 to include in my calculation

Steve :-/

okay then use something like this and remember to select "Treat blank fields as zeros"

Datatype: Formula(TEXT)

```IF(Field1 > 0, TEXT(Field1) + "/", NULL) +
IF(Field2 > 0, TEXT(Field2) + "/", NULL) +
IF(Field3 > 0, TEXT(Field3) + "/", NULL) +
IF(Field4 > 0, TEXT(Field4), NULL)```

ani123

but if i select field 4 i am getting field4/ the format is wrong if i input field 4 i need the output with only field 4

Steve :-/

Can you post the Formula you're using?  My formula is:

```IF(Field1 > 0, TEXT(Field1) + "/", NULL) +
IF(Field2 > 0, TEXT(Field2) + "/", NULL) +
IF(Field3 > 0, TEXT(Field3) + "/", NULL) +
IF(Field4 > 0, TEXT(Field4), NULL)```
ani123

I AM USING UR FORMULA .

FORMULA IS CORRECT WHEN I WORK WITH 2 OR 3 FIELDS FOR EX:

MY INPUT FOR FIELD 1:4

MY INPUT FOR FIELD 2:8

MY INPUT FOR FIELD 3:6

my FORMULA OUTPUT WILL BE:4/8/6

whereas if i only input for Field 1:4

my FORMULA OUTPUT is 4/(ITS WRONG)

I WANT THE O/P TO BE :4

Steve :-/

Can you PLEASE post the formula code that you are using???