简体   繁体   English

谷歌表格; 在行号为 > 另一个公式中生成的行号的列中查找第一个包含 0 的单元格

[英]Google Sheets; Finding the first cell to contain 0 in a column where the row number is > the row number generated in another formula

I'm making a document in Google sheets that produces the start and end times where a number of people are in a section.我正在 Google 表格中制作一个文档,该文档会生成一个部分中有很多人的开始和结束时间。 I was able to produce a grid, but I can't seem to find a formula for calculating end times that occur after the start time.我能够生成一个网格,但我似乎找不到计算开始时间之后发生的结束时间的公式。

Time时间 Section1第一节 Section2第二节
9:00am 9:00 AM 1 1个 0 0
9:30am上午 9:30 1 1个 0 0
10:00am 10:00 AM 1 1个 1 1个
10:30am上午 10:30 0 0 1 1个

I want to make a series of formulas that list the start and end times when people are present in a section.我想制作一系列公式,列出人们出现在某个部分的开始和结束时间。

  1. (Start time) Find the first cell to not contain 0 and return the value in column A {I have found a formula for this step} (开始时间)找到第一个不包含0的单元格并返回A列的值{我已经找到了这一步的公式}
  2. (End time) Find the first cell to contain 0 where the row number is greater than the row number of the previous start time and return the value in column A (结束时间)找到第一个行号大于上一个开始时间行号的0的单元格,返回A列的值

For the first part, I can find the start time with the formula对于第一部分,我可以用公式找到开始时间

=IFNA(INDEX($A$2:$A,(MATCH(TRUE,INDEX($B$2:$B>0,0),0))))

But when I try to adapt it to the end time by changing the greater than (>) to equals (=), it gives me the first time there is a zero regardless of if it occurs before the start time.但是,当我尝试通过将大于 (>) 更改为等于 (=) 来使其适应结束时间时,无论它是否发生在开始时间之前,它都会第一次给我一个零。 I feel like adding some kind of row check will be necessary to fix this, but I'm not sure how.我觉得有必要添加某种行检查来解决这个问题,但我不确定如何。 I would really rather not learn Google API if at all possible,如果可能的话,我真的宁愿不学习谷歌 API,

If it's just to find the first 0 after a 1, you could benefit from the use of INDEX and MATCH to create a range that goes from the first 1 to the last row and look the 0 in that range.如果只是查找 1 之后的第一个 0,您可以使用 INDEX 和 MATCH 创建一个从第一个 1 到最后一行的范围并查看该范围内的 0。 That is: INDEX(B2:B,MATCH(1,B2:B,0)):INDEX(B2:B,ROWS(B2:B)) So, inserted in the whole formula:即: INDEX(B2:B,MATCH(1,B2:B,0)):INDEX(B2:B,ROWS(B2:B))因此,插入整个公式:

=INDEX(A2:A,MATCH(1,B2:B,0)  +  MATCH(0, INDEX(B2:B,MATCH(1,B2:B,0)):INDEX(B2:B,ROWS(B2:B)) ,0)-1)

暂无
暂无

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

相关问题 如何在 Google 表格公式中指定一个范围,其中结束行号是对另一个单元格的引用? - How to specify a range in a Google Sheets formula, where the end row number is a reference to another cell? 谷歌表格 - 根据公式内的另一个单元格值设置行号? - Google Sheets - Set row number based from another cell value, inside the formula? Google表格,尝试使用公式来引用另一张表格中的单元格来确定行号 - Google Sheets, Trying to reference a cell in another sheet using a formula to determine the row number Google Sheets Scripts - 对于范围内的每个单元格,获取单元格具有特定值的行号,将行复制到范围内的第一个空白行 - Google Sheets Scripts - For each cell in range, get row number where cell has specific value, copy row to first blank row in range 从与另一个单元格的同一行但不同列对应的单元格中检索数字值(谷歌表格) - Retrieve a number value from a cell corresponding to the same row but different column of another cell (Google Sheets) 检索 Google 表格公式的行号 - Retrieve Row Number for Google Sheets formula 在Google表格中的用户定义公式中获取行号 - get ROW number in a user defined formula in google sheets 使用数组公式,返回从列的第一行到当前行的最后一个非空白单元格的行号 - Return the row number of the last non blank cell, comparing from the first row of a column until the current row, using an array formula Google表格 - 插入行增量公式单元格 - Google Sheets - insert row increments formula cell 限制 Google 表格中的行数 - Limit the number of row in Google Sheets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM