# Formula to display page numbers in Excel

I have a multiple page report in Excel.  On the first page, which I know will be the first page I want to display page 1 as
- 1 -
On the second and subsequent pages, I want to display the page numbers as
Page 2, Page 3, etc. , but only if there is a value in cell i18,
LVL 1
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Ok, since you asked for the formula solution, here is the workaround.

please see the completed file in the attached workbook.

name range with the name of "PageNumber" created and the reference is put =GET.DOCUMENT(64)

then formula =IF(I18<>"","Page "&IF(ISNA(MATCH(ROW(),PageNumber)),1,MATCH(ROW(),PageNumber)+1),"")   put anywhere you want to see the Page number to appear.  it will check if the cell i18 is empty then it will not put anything and if it is not empty then it will put the page number
EE.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Executive Managing MemberAuthor Commented:
It worked, almost.  I have no idea how this formula works.

It labeled page 2 as Page 3 and page 3 as Page 4, etc.

So I modified the formula replacing the +1 with +0.

=IF(I18<>"","Page "&IF(ISNA(MATCH(ROW(),PageNumber)),1,MATCH(ROW(),PageNumber)+1),"")

And it works just fine.  Thanks.
0
Commented:
:-)

thanks BlueSkyBill for the feedback and i am glad i was able to help.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.