Is it possible to query data based on date if each sheet is different date?

Ronderbecke

Board Regular
Joined
Oct 4, 2017
Messages
73
I have a document that has many sheets with the columns being the same across all of them but the data changing slightly on each sheet. Each of the sheets is labeled (named) by date that the data got changed (first sheet is 8/1/2021 and the next one is 9/17/2021 and then 12/13/2021 etc. I don't know that its even possible, but if I am putting in another sheet that needs to query based on the date the product was sold, is it possible to create a function that queries from the correct sheet? Example:

Date of salePanel used
8/9/2021?????

since that date is after 8/1/2021 but before 9/17/2021, I need a function that knows to query the 8/1/2021 sheet. Is that possible?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hey Ronderbecke - Excel doesn't allow you to have special characters like "/" in your sheet names, so your sheets wouldn't be called "8/1/2021".

Can you let us know what your sheets are actually named?

It sounds like you can use the =INDIRECT() formula to solve your problems, but it will depend on what your actual sheet names are.
 
Upvote 0
Hey Ronderbecke - Excel doesn't allow you to have special characters like "/" in your sheet names, so your sheets wouldn't be called "8/1/2021".

Can you let us know what your sheets are actually named?

It sounds like you can use the =INDIRECT() formula to solve your problems, but it will depend on what your actual sheet names are.
Sorry

August 1 2021
September 17 2021
December 13 2021
 
Upvote 0
Ok great,

So we can use the INDIRECT formula, but we would first need to convert any date that you have in a cell to the same format as your tabs.

The easiest way to do this is just to use the TEXT formula - so if your first date "8/9/2021" is in cell A2, we could use this:

Excel Formula:
=TEXT(A2,"Mmmm d yyyy")


Which would return "August 9 2021"

Then we combine this with the INDIRECT formula to lookup a value on the other sheet:

Excel Formula:
=INDIRECT("'"&TEXT(A2,"Mmmm d yyyy")&"'!A1")

Which will return the value of cell "A1" from the tab "August 9 2021" by reformatting your cell references into this format:

=INDIRECT("'August 9 2021'!A1"), which behaves just like a normal link to the cell A1 in sheet "August 9 2021".

For this to pull the data you need, you would just need to replace the cell reference "A1" with the appropriate cell that you're looking for on another tab.

Hope that helps.
 
Upvote 0
Solution
Ok great,

So we can use the INDIRECT formula, but we would first need to convert any date that you have in a cell to the same format as your tabs.

The easiest way to do this is just to use the TEXT formula - so if your first date "8/9/2021" is in cell A2, we could use this:

Excel Formula:
=TEXT(A2,"Mmmm d yyyy")


Which would return "August 9 2021"

Then we combine this with the INDIRECT formula to lookup a value on the other sheet:

Excel Formula:
=INDIRECT("'"&TEXT(A2,"Mmmm d yyyy")&"'!A1")

Which will return the value of cell "A1" from the tab "August 9 2021" by reformatting your cell references into this format:

=INDIRECT("'August 9 2021'!A1"), which behaves just like a normal link to the cell A1 in sheet "August 9 2021".

For this to pull the data you need, you would just need to replace the cell reference "A1" with the appropriate cell that you're looking for on another tab.

Hope that helps.
Thank you, I knew I was missing something. I really appreciate the help.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top