# Nest an IF Formula

Options
✭✭✭✭✭

With the help of the community, I have two formulas that I would like to combine into one if possible.

Formula 1

`=IF(Ancestors@row = 0, COUNTIF(Ancestors\$1:Ancestors@row, Ancestors@row = 0), "")`

Formula 2

`=IF(LEN(RowID@row) = 1, "000" + RowID@row, IF(LEN(RowID@row) = 2, "00" + RowID@row, IF(LEN(RowID@row) = 3, "0" + RowID@row, RowID@row)))`

My failed try

This throws an #INCORRECT ARGUMENT SET error

`=IF(ANCESTORS@row = 0, COUNTIF(ANCESTORS\$1:ANCESTORS@row, ANCESTORS@row = 0, "", (IF(LEN(RowID@row) = 1, "000" + RowID@row, IF(LEN(RowID@row) = 2, "00" + RowID@row, IF(LEN(RowID@row) = 3, "0" + RowID@row, RowID@row))))))`

Tags:

• ✭✭✭✭✭✭
Options

How exactly are you trying to combine them? What is the desired end result?

• ✭✭✭✭✭✭
Options

Hi Stavros,

Have you tried to change the order of the formulas IF parts?

I hope that helps!

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.

• ✭✭✭✭✭
Options

Thanks all... With a little bit of manipulation, I got this to work as expected

• ✭✭✭✭✭✭
Options

Excellent!

Happy to help!

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.

• ✭✭✭✭✭✭
Options

Excellent! Happy to help! 👍️

• ✭✭✭✭✭✭
Options

Excellent! Happy to help! 👍️

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!