Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
232 views
in Technique[技术] by (71.8m points)

Excel, dynamic referencing dates

I'm struggling to implement a dynamic reference within excel when using dates. The formula I'm using works with other strings but dates seem to be an issue.

=INDIRECT(C$2&"!$C2")

The first instance of C2 is equal to 04-01-2021, the same as the sheet (name) I want to reference. ?

The second instance of C2 pulls in a [Y]es or [N]o which works fin if the references / sheets are not dates.

Could someone point me in the right direction please?

Thanx for looking, Sam

EDIT: I've tried using another suggestion but I'm still getting no joy.

=INDIRECT("'"&TEXT(C2,"dd-mm-yyyy")&"'!"&C2)

This pulls in the date:

=TEXT(C2,"dd-mm-yyyy")

04-01-2021

What am I doing wrong with the indirect function?

EDITv2: I was going to upload an example but obviously I'm too dense to be able to find any sort of upload button / link on stackoverflow.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Figured it.

I was using dates and forgot to wrap my dates in speech marks for them to reference correctly.

Master Sheet C2 contents:

="04-01-2021"

Sheet name:

04-01-2021

Thanx for your help @Carter Bayer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...