Show the column header to a row if there is value in cells of that columns without VBA

后端 未结 4 375
刺人心
刺人心 2021-01-13 15:56

Update 1:

Because my question is not clear, so I post second example

\"Example

Because row

4条回答
  •  無奈伤痛
    2021-01-13 16:46

    I posted a formula in the comments above, you may not have seen it. This is it:

    =IF(COUNTA($B2:$D2)=0,"",INDEX($B$1:$D$1,MATCH(TRUE,INDEX($B2:$D2<>"",0),0)))

    that will get the header for the first instance of a populated cell - if you have numeric values and want to ignore zeroes change to

    =IF(COUNTA($B2:$D2)=0,"",INDEX($B$1:$D$1,MATCH(TRUE,INDEX($B2:$D2>0,0),0)))

    Either way the formula can be extended to as large a range as you need

    .....and if you have 500 columns you could use IFERROR to shorten a little

    =IFERROR(INDEX($B$1:$D$1,MATCH(TRUE,INDEX($B2:$D2>0,0),0)),"")

提交回复
热议问题