Reference next or previous sheet in a formula if the sheet number/name is a varible/variant

前端 未结 2 1210
北荒
北荒 2021-01-23 06:07

How do I reference next or previous sheet in a formula if the sheet number/name is a varible/variant.

I have seen ways to do this with vba, is there a way to do this wit

2条回答
  •  半阙折子戏
    2021-01-23 06:27

    Here is another way to list out all the sheet names with regular Excel formula:

    1. Cell A1: =CELL("filename",1:1048576)

    2. Cell B1: =MID(A1,FIND("[",A1)+1,FIND("]",A1)-FIND("[",A1)-1)

    3. Go to Formula > Name Manager > New, like the pic below, enter SheetNames in the Name field and the formula below in the Refers to field:

      =GET.WORKBOOK(1,Sheet29!$B$1)&T(NOW())

      Please note that I setup this on Sheet29. You should change that to the sheet you are using.

    4. From cell A2, fill out the formula below and drag down to list all the sheet names:

      =INDEX(MID(SheetNames,FIND("]",SheetNames)+1,255),ROWS(A$1:A1))

    In my example, I don't have Sheet28 and also the sheet name is sorted by the order from left to right. Move around and check the result.

提交回复
热议问题