# If/Then/Else - that I can't find answered anywhere in the community

Options

If cell A1 starts with "01-" then replace (the "01-") with "AAAA" else if cell A1 starts with "02-" then replace (the "02-") with "BBBB" else replace the first three characters in cell A1 with "CCCC". Thanks in advance! Tom

• ✭✭✭✭✭✭
Options

Hi @Tom Vick

Hope you are fine, please try the following formula.

=IF(LEFT([Column7]@row, 3) = "01-", "AAAA-" + MID([Column7]@row, 4, 1000), IF(LEFT([Column7]@row, 3) = "02-", "BBBB-" + MID([Column7]@row, 4, 1000), "CCCC-" + MID([Column7]@row, 4, 1000)))

the following screenshot shows the result.

bassam.khalil2009@gmail.com

• ✭✭✭✭✭✭
Options

Hi @Tom Vick

Hope you are fine, please try the following formula.

=IF(LEFT([Column7]@row, 3) = "01-", "AAAA-" + MID([Column7]@row, 4, 1000), IF(LEFT([Column7]@row, 3) = "02-", "BBBB-" + MID([Column7]@row, 4, 1000), "CCCC-" + MID([Column7]@row, 4, 1000)))

the following screenshot shows the result.

bassam.khalil2009@gmail.com

• ✭✭✭✭✭✭
Options

I hope you're well and safe!

Here's another option. (we could also use SUBSTITUTE)

=IF(CONTAINS("01-"; [A1]@row); REPLACE([A1]@row; 1; 3; "AAAA"); IF(CONTAINS("02-"; [A1]@row); REPLACE([A1]@row; 1; 3; "BBBB"); REPLACE([A1]@row; 1; 3; "CCCC")))

Depending on your country/region, you'll need to exchange the comma to a period and the semi-colon to a comma.

Would that work/help?

I hope that helps!

Be safe and have a fantastic day!

Best,

Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

SMARTSHEET EXPERT CONSULTANT & PARTNER

Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

W: www.workbold.com | E:andree@workbold.com | P: +46 (0) - 72 - 510 99 35

Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!