Returning cell values from other sheets by referencing sheet names from a list

こ雲淡風輕ζ 提交于 2021-02-08 14:44:03

问题


I have a spreadsheet with approx twenty different sheets named by stock ticker. Because these are templates, the information in each sheet is found in the same cells. For example, the EPS for the current year is always in cell A55 regardless of the sheet.

I want to build a summary sheet that will pull data from the templates based on the tickers. So envision a summary sheet with tickers (also sheet names) down column A and formulas in columns B to reference the same position in each different sheet in the list.

I know I can build out one row and then simply copy it down and do Find/Replace for each sheet name/ticker, but it seems I should be able to automate the formulas so these know to look at column A, then go to the sheet with that name, then return the data that is referenced in the formula. This would make it much easier to add sheets/tickers as time went on. I have tried =INDIRECT without success.

How do I get the formulas to reference column A in the summary sheet so that these know in which template/sheet to look up the information?


回答1:


Please try:

=INDIRECT(A1&"!A55")

Regarding Alaa M's Comment and Xenix Chroptl's Answer, spaces in the sheet name are handled, though extra quotes are required:

=INDIRECT("'"&A1&"'!A55")



回答2:


EDIT:

This answer did not really help, but I will leave this for anyone in the future wondering how use the INIDRECT() formula, in a SUM() formula as an example. If you wanted to sum column B in Sheet1, then you would do something like this:

=SUM(INDIRECT(A1&"!B:B"))

The contents of cell A1 being "Sheet1", then drag and fill into the other rows




回答3:


Just stumbled across this while trying to solve a similar problem.

In case your tab titles include spaces or odd characters (such as hyphens), frame the tab reference (A1) in literal single quotes ("'"). Otherwise, you get #REF! errors when it tries to evaluate the reference.

=INDIRECT("'"&A1&"'!A55)



来源:https://stackoverflow.com/questions/21247457/returning-cell-values-from-other-sheets-by-referencing-sheet-names-from-a-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!