简体   繁体   中英

Count consecutive increase values with blank cell in Excel

I have a formula for counting consecutive increase of values in a row range. It seem to work properly with #N/A values (which I have in my dataset) but I get some issues with the first blank value in a row. In my example below I should have 3 increases (green cells) for both rows.

Formulas are (they are array formulas, Ctrl + Shift + Enter):

J2: {=SUM(IFERROR(--((C2:H2>B2:G2)=TRUE);0))}

J3: {=SUM(IFERROR(--((C3:H3>B3:G3)=TRUE);0))}

It seems that formula in J3 count D3 as 0 and therefore count an increase from 0 to 0,22.

在此输入图像描述

使用此数组公式使用ctrl + shift + enter完成它而不是只输入。

=SUMPRODUCT(IFERROR((C2:H2>B2:G2), 0)*IFERROR(B2:G2<>"", 0))

I think you're right about blank being treated as 0. I suggest dividing your first logical equation (C3:H3>B3:G3)=TRUE by B3:G3<>"", resulting in a divide-by-zero error on blanks:

J3: {=SUM(IFERROR(--((C3:H3>B3:G3)=TRUE / ((B3:G3)<>""));0))}

Does this fix it for you?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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