Excel Match If Greater than Zero

蹲街弑〆低调 提交于 2019-12-12 04:36:19

问题


I'm working in excel and i want to use the formula MATCH to retrieve the row of each number greater than zero in a column. For example, having the next column

Number 
  0
  0
  6
  1
  0
  8
  0 
  0
  0
  0
  10

I want to obtain in other column the following:

Rows
  3
  4
  6
 11

¿Is it posible to do this with the MATCH formula? If not, then ¿How can achieve this?


回答1:


Assuming your data is in the range A2:A12, then try this Array Formula which requires confirmation with Ctrl+Shift+Enter instead of Enter alone.

In B2

=IFERROR(SMALL(IF($A$2:$A$12>0,ROW($A$2:$A$12)-ROW($A$2)+1),ROWS(B$2:B2)),"")

Confirm with Ctrl+Shift+Enter and then copy it down until you get blank cells.

Adjust the ranges as per requirement, but don't refer the whole column reference like A:A in the formula.




回答2:


B1:    =MATCH(TRUE,A:A>0, 0)                              Ctrl+Shift+Enter

B2:    =IFERROR(MATCH(TRUE,(A:A>0)*ROW(A:A)>B1, 0),"")    Ctrl+Shift+Enter

copy B2 and paste along column B.




回答3:


Assuming your data is in the range A2:A12.

  1. Select the cells B2:B12. Press F2. It will allow you to enter values in the B2 cell.
  2. Copy paste the below formula in the B2 and then press Ctrl+Shift+Enter

=IFERROR(AGGREGATE(15,6,IF(A2:A12<>0,ROW()-ROW(A1),NA),ROW()-ROW(B1)),"")

Note if you select only B2 and enter the formula then you will get only the top one value. Adjust ranges accordingly if required.



来源:https://stackoverflow.com/questions/43451683/excel-match-if-greater-than-zero

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