查找包含数字的行中的第一个单元格?
我正在 Excel 中使用导出的表格,如下所示:
|-------------------------------------------------------------------------------|
| | A | B | C | D | E | F | G | H | I |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 1 | Domain | JAN | FEB | MAR | APR | MAY | Start | End | Change |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 2 | www.mydomain1.com | | 1 | 4 | 3 | 1 | 1 | 1 | 0 |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 3 | www.mydomain2.com | 2 | 4 | 12 | 18 | 23 | 2 | 23 | 21 |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 4 | www.mydomain3.com | | | 14 | 12 | | 14 | xxx | NOT FOUND |
|-------------------------------------------------------------------------------|
我正在尝试将当前状态(最后一个单元格)与原始单元格(第一个带有值的单元格)进行比较。
在 I 列中,我有公式 =IF(G2 = "xxx", "NOT FOUND", IF(H2 = "xxx", "NOT FOUND", H2 - G2))
在 H 列中,我有公式 =IF(F2 = "", "xxx", F2)
在 G 列中,我需要找到第一个带有数字的单元格。如果该范围内没有,我需要 G 为“xxx”。我想我只需要检查范围(B2 到 F2)中包含值的第一个单元格,而不仅仅是数字。我尝试使用索引和匹配组合,但我不太理解它。
I'm working in Excel with an exported table such as this:
|-------------------------------------------------------------------------------|
| | A | B | C | D | E | F | G | H | I |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 1 | Domain | JAN | FEB | MAR | APR | MAY | Start | End | Change |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 2 | www.mydomain1.com | | 1 | 4 | 3 | 1 | 1 | 1 | 0 |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 3 | www.mydomain2.com | 2 | 4 | 12 | 18 | 23 | 2 | 23 | 21 |
|---|-------------------|-----|-----|-----|-----|-----|-------|-----|-----------|
| 4 | www.mydomain3.com | | | 14 | 12 | | 14 | xxx | NOT FOUND |
|-------------------------------------------------------------------------------|
I'm trying to compare the current state (last cell) to the original cell (first cell with a value).
In column I, I have the formula =IF(G2 = "xxx", "NOT FOUND", IF(H2 = "xxx", "NOT FOUND", H2 - G2))
In column H, I have the formula =IF(F2 = "", "xxx", F2)
In column G, I need to find the first cell with a number. If there isn't one in that range, I need G to be "xxx". I suppose I only need to check for the first cell in the range (B2 to F2) that contains a value, not just a number. I tried using an Index and Match combo, but I couldn't quite understand it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下公式(在
$G$2
中并填写)应该可以解决问题:请注意,只有在第一个条目和最后一个条目之间没有其他空白单元格时,这才有效。
更新:这是一个更通用的选项来自 Mr.Excel 论坛:
此公式必须作为“数组公式”输入,这意味着粘贴公式后必须按 CTRL-SHIFT-ENTER。
对评论的回复:
您可以执行以下操作,而不是重复整个公式:
The following formula (in
$G$2
and filled down) should do the trick:Note that this will only work if there are no other blank cells in between the first and last entries.
update: Here is a more versatile option from the Mr.Excel forum:
This one has to be entered as an "array formula" which means you must press CTRL-SHIFT-ENTER after pasting in the formula.
response to comment:
Rather than duplicate the whole formula, you could do the following:
如果作为 ARRAY 公式输入(ctrl-shift-enter),则以下内容有效。
如果中间有空白单元格也适用。
HTH
编辑
这也控制错误:
The following works if entered as an ARRAY formula (ctrl-shift-enter).
Works also if there are blank cells in the middle.
HTH
Edit
This one controls the error too: