Google-sheets – Alternate to Nested IF statements

formulasgoogle sheets

enter image description here

Goal here is to have the sheets search a row, then once it finds the first instance of >=0, return the cell value that contains the month+concatenate the value in the cell next to it (or any other cell of choice). I've confirmed I can do this with a series of nested IF statements, but am looking for something more efficient. I'm not too terribly familiar with writing my own scripts, but can if someone can give general direction.

Best Answer

From rev 1:

Please note that the month is above the value.

Formula

=ArrayFormula(INDEX(SPLIT(JOIN(",",IF(C2:2>=0,$C1:$1,)),","),1))

Explanation

  • $C1:$1 refers to the headers row C2:2 refers to the values row.
  • IF returns an array where values equal and greater than 0 are included and blank is included for values that are less than 0.
  • JOIN creates a string using a comma to separate array values.
  • SPLIT splits the string omitting the blank members.
  • INDEX returns the first member.