如何更有效地使用Excel的INDIRECT函数从多个工作表中获取数据

huangapple go评论92阅读模式
英文:

How to use the Excel INDIRECT function more effectively in fetching data from multiple sheets

问题

我有一个工作簿,其中第一个工作表是同一工作簿中后续工作表的汇总。汇总工作表应从工作簿中的其他工作表中获取数据,表格具有星期一到星期五 - 五天作为列,以及月度日期作为行标题,例如7月1日,7月2日... ... 7月31日。共有5个工作表,分别命名为 - 星期一、星期二、星期三、星期四和星期五(从C列到G列)。每个工作表都有一个只有一列的表格,即“批次号”,并且对于月度日期的每一天,从第10行开始有行。每当在一个或多个工作表中的任何一个日期填写了批次号时,相同的值应在汇总工作表的相应单元格中获取。每当工作表单元格未更新为某个值时,相应的汇总单元格也应为空,而不是零。如何使用Excel间接函数高效实现这一点?此处描述的工作簿链接

英文:

I have a workbook in which the first worksheet is the summary of subsequent worksheets in the same workbook. The Summary sheet should fetch data from the other sheets in a table in the workbook. The table has Monday to Friday - five days as columns and monthly dates as row headers e.g. 1-Jul-23, 2-Jul-23.....31-Jul-23. There are 5 worksheets each named - Monday, Tuesday, Wednesday, Thursday, and Friday (from Columns C to G). Each worksheet has a table with only one column viz., “Batch no.” and rows (from row 10 onward) for each date of the month. Whenever any of the batch no. is filled against any date of the month in one or more sheets, the same value should get fetched in the summary sheet table in the appropriate cell. Whenever the sheet cell is not updated with a value, the corresponding summary cell also should show blank and not zero. How to do this efficiently using the Excel Indirect function?The workbook link described here

答案1

得分: 1

如果您的日期与文件中的日期一致,您可以使用以下代码:

=LET(h,HSTACK(Monday:Friday!C10:C22),
     IF(h="","",h))

否则,您可以使用以下代码:

=LET(i,INDEX(HSTACK(Monday:Friday!C10:C22),
             XMATCH(B10:B22,B10:B22),
             XMATCH(C9:G9,C9:G9)),
IF(i="","",i))
英文:

If your dates are consistent like in your file, you could use this:

=LET(h,HSTACK(Monday:Friday!C10:C22),
     IF(h="","",h))

otherwise you could use:

=LET(i,INDEX(HSTACK(Monday:Friday!C10:C22),
             XMATCH(B10:B22,B10:B22),
             XMATCH(C9:G9,C9:G9)),
IF(i="","",i))

huangapple
  • 本文由 发表于 2023年7月10日 14:26:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76651140.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定