简体   繁体   English

如何将这些硬编码的单元格引用更改为动态引用?

[英]How to change these hard-coded cell references to dynamic references?

I have this spreadsheet: 我有这个电子表格:

在此处输入图片说明

and I have the following formula, which gets me exactly the results I need: 并且我有以下公式,它为我提供了所需的确切结果:

在此处输入图片说明

The problem I have is with the cell references being hard coded. 我的问题是单元格引用被硬编码。 I need it all to be dynamic, because the information I'm targeting is based on the date. 我需要所有这些都是动态的,因为我定位的信息是基于日期的。 Today I need the information in rows 23-28. 今天,我需要第23-28行中的信息。 tomorrow it could be rows 5-10 or rows 30-40. 明天可能是5-10行或30-40行。

How can I look through the entire column A to find today's date, and then display only the rows of information pertaining to that date? 我如何浏览整个A列以查找今天的日期,然后仅显示与该日期有关的信息行? I can do it with hard-coded row numbers, but I can't figure out how to do this with dynamic row numbers. 我可以用硬编码的行号来做到这一点,但我不知道如何使用动态行号来做到这一点。

Use this formula (it's a regular formula, no need for array entry): 使用以下公式(这是一个常规公式,无需数组输入):

=IF(ROW(A1)-1>=IFERROR(MATCH("*day",INDEX($A:$A,MATCH(TEXT(TODAY(),"m/dd")&"*",$A:$A,0)+1):$A$65000,0),IFERROR(MATCH(REPT("z",255),INDEX($A:$A,MATCH(TEXT(TODAY(),"m/dd")&"*",$A:$A,0)+1):$A$65000)+1,MATCH(2^999,INDEX($A:$A,MATCH(TEXT(TODAY(),"m/dd")&"*",$A:$A,0)+1):$A$65000)+1)),"",INDEX(A:A,MATCH(TEXT(TODAY(),"m/dd")&"*",$A:$A,0)+ROW(A1)-1))

Then copy over and down to get all of your data. 然后上下复制以获取所有数据。 Format the cells containing the formula with this custom format code: General;General;;@ so that returns that should be blank are blank instead of 0s. 使用以下自定义格式代码设置包含公式的单元格的格式: General;General;;@以便应为空的返回值是空白而不是0。

Get the row references first as helpers and then change your current formula using INDIRECT 首先获取行引用作为助手,然后使用INDIRECT更改当前公式

=INDEX(INDIRECT("A" & $K$19):INDIRECT("A" & $K$20)...

Where K19 and K20 are the cells where you have the formula which finds you the row number of today and not tomorrow. 其中K19K20是单元格,您可以在其中找到用于计算今天而不是明天的行号的公式。

You could put the formula to find the row numbers in instead of the reference like 您可以使用公式来查找行号,而不是像这样的引用

=INDEX(INDIRECT("A" & FormulaFirstToday):INDIRECT("A" & FormulaLastToday)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM