Add to INDEX formula to account for blank cells?

I have a mapped column that displays a Contact based on what's inputted in another cell. E.g. Slim J = Slim Julian.

Here's the formula: =INDEX({PD - NetSuite Name Mapping USE Range 1}, MATCH([PDS Selected]@row, {Formstack Name}, 0))

However, if the cell is blank, it just assigns the first Contact alphabetically, even though there's nothing to match to.

Is there a way to add to the formula above so it just keeps the mapped Contact blank if the input cell is blank?

Best Answer

  • bisaacs
    bisaacs ✭✭✭✭✭
    edited 04/19/24 Answer ✓

    Hey @amy_ilearning,

    I would wrap this in an if statement, and make it so your formula only calculates if it's not blank:

    =IF(ISBLANK([Formstack Name]), "", INDEX({PD - NetSuite Name Mapping USE Range 1}, MATCH([PDS Selected]@row, {Formstack Name}, 0)))

    Hope this helps!

    If my response was helpful in any way (or answered your question) please be sure to upvote it, mark it as awesome, or mark it as the accepted answer!

    I'm always looking to connect with other industry professionals, feel free to connect with me on LinkedIn as well!

Answers

  • bisaacs
    bisaacs ✭✭✭✭✭
    edited 04/19/24 Answer ✓

    Hey @amy_ilearning,

    I would wrap this in an if statement, and make it so your formula only calculates if it's not blank:

    =IF(ISBLANK([Formstack Name]), "", INDEX({PD - NetSuite Name Mapping USE Range 1}, MATCH([PDS Selected]@row, {Formstack Name}, 0)))

    Hope this helps!

    If my response was helpful in any way (or answered your question) please be sure to upvote it, mark it as awesome, or mark it as the accepted answer!

    I'm always looking to connect with other industry professionals, feel free to connect with me on LinkedIn as well!

  • You're a genius! Worked perfectly - thank you!

  • amy_ilearning
    amy_ilearning ✭✭✭
    edited 04/19/24

    @bisaacs Here's another weird one that needs a blank. Instead of mapping, I'm combining the values of several cells into one cell formatted for Contacts. However, if all the cells in the range are blank, it shows #INVALID VALUE in the cell dedicated to combining the value.

    Here's the formula: =INDEX(COLLECT([Core A-C]@row:[Non-Core S-Z]@row, [Core A-C]@row:[Non-Core S-Z]@row, @cell <> ""), 1)

    I tried =IF(ISBLANK([Core A-C]@row:[Non-Core S-Z]@row), "", INDEX(COLLECT([Core A-C]@row:[Non-Core S-Z]@row, [Core A-C]@row:[Non-Core S-Z]@row, @cell <> ""), 1)) but I get an #INCORRECT ARGUMENT

    Any ideas on how to adjust the formula so it also leaves this Contact column blank if the cells the formula is pulling from are all blank?

  • bisaacs
    bisaacs ✭✭✭✭✭

    Hey @amy_ilearning,

    I think the issue is ISBLANK doesn't accept a range of cells, just one cell, so we'll have to use the AND function to chain together multiple ISBLANK functions:

    =IF(AND(ISBLANK([Core A-C]@row), ISBLANK([Non-Core S-Z]@row)), " ", INDEX(COLLECT([Core A-C]@row:[Non-Core S-Z]@row, [Core A-C]@row:[Non-Core S-Z]@row, @cell <> ""), 1))

    Hope this helps!

    If my response was helpful in any way (or answered your question) please be sure to upvote it, mark it as awesome, or mark it as the accepted answer!

    I'm always looking to connect with other industry professionals, feel free to connect with me on LinkedIn as well!

  • Thank you so much!!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!