Trying to evaluate a range for a value in random positions

Jared Grigg
Jared Grigg ✭✭
edited 06/02/22 in Formulas and Functions

I've been trying for a few days to stitch a formula together with multiple tools but I'm coming up short.

I have a form that leverages logic so that a specific option-set value selected, produces a sub-set of options. Thus, for each value in the option set, there is a corresponding sub-set that only displays when that specific value is selected. A sub option can then be selected.

So far so good. I love this form feature.

So now, I have a range of sub-option fields that will provide additional info for that record. Since only ONE field in that range will have a value, I was hoping to hide those columns and instead identify the one with content and return that value into a summary field.

FOR EXAMPLE; if I had a table like the attached (below) example, I need a formula I can put in column A (the summary field mentioned above) that returns the NUMBER in the first two positions of the cell that is not blank in the range B:F

I can insert the following formula; =VALUE(LEFT([B]@row, 2))

in A1 and it returns 11 which is great, however, column B is not always the field with the relevant value. Each record will only have ONE value in ONE of the fields of that range depending on the original option selected in the form.

BTW, =VALUE(LEFT([B]@row:[F]@row, 2)) returns an error. I've tried to inject other Functions in various combinations but have had no luck.

I'm hoping I can evaluate the range, identify where the value is, then extract only the numerical value.

I'm wondering if I have to build a more complex formula that looks at each cell in the range separately, then somehow identify which one to run a value conversion on? Or some other concatenation?

I would appreciate any suggestion!! THANKS

Best Answers

  • Mike TV
    Mike TV ✭✭✭✭✭✭
    Answer ✓

    @Jared Grigg

    This should work. Example sheet:

    A column formula:

    =IF(NOT(ISBLANK(B@row)), VALUE(LEFT(B@row, 2)), IF(NOT(ISBLANK(C@row)), VALUE(LEFT(C@row, 2)), IF(NOT(ISBLANK(D@row)), VALUE(LEFT(D@row, 2)), IF(NOT(ISBLANK(E@row)), VALUE(LEFT(E@row, 2)), IF(NOT(ISBLANK(F@row)), VALUE(LEFT(F@row, 2)), "")))))

  • Andrée Starå
    Andrée Starå ✭✭✭✭✭✭
    Answer ✓

    Hi @Jared Grigg

    I hope you're well and safe!

    To add to Mike's excellent advice/answer.

    Here's another option.

    =LEFT(JOIN(B@row:F@row, ""), 2)

    Did that work/help?

    I hope that helps!

    Be safe and have a fantastic weekend!


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

    Did my post(s) help or answer your question or solve your problem? Please support the Community by marking it Insightful/Vote Up or/and as the accepted answer. It will make it easier for others to find a solution or help to answer!


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

    W: | | 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!