View Single Post
  #2   Report Post  
Domenic
 
Posts: n/a
Default

I haven't fully tested it, but see if this will do...

Assuming that Sheet1 contains your source data, and Sheet2 contains your
expected results...

1) If there will always be at least one set of consecutive pairs...

Sheet2!B19, copied across and down:

=IF(INDEX(Sheet1!$B19:$G19,MATCH(2,1/(Sheet1!$C19:$H19-Sheet1!$B19:$G19=1
)))=B$1,SUM(B$1,A19),IF(COUNTIF($A19:A19,"0")=1,S UM(A19,1),""))

....confirmed with CONTROL+SHIFT+ENTER.

2) If there may not be at least one consecutive pair...

Sheet2!B19, copied across and down:

=IF(1-ISNA(MATCH(2,1/(Sheet1!$C19:$H19-Sheet1!$B19:$G19=1))),IF(INDEX(She
et1!$B19:$G19,MATCH(2,1/(Sheet1!$C19:$H19-Sheet1!$B19:$G19=1)))=B$1,SUM(B
$1,A19),IF(COUNTIF($A19:A19,"0")=1,SUM(A19,1),"") ),"")

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article ,
"Sam via OfficeKB.com" wrote:

Hi All,

I am using the formula below to return one specific value referenced in an
input cell B1:

=IF((COUNTIF(INDEX(Stock,ROW()-ROW(Stock)+1,0),B$1))=1,B$1,"")

How might a more suitable formula or the above formula be expanded to find
pairs of consecutive values in ascending order in a Dynamic Defined Range
“Stock” ( 7 Columns B-H and many Rows), and return the two consecutive
values on the same Row in separate columns (side by side) on a new sheet.

Sample Data – Defined Dynamic Range “Stock”:
COL B C D E F G H
ROW19 70 72 87 88 89 92 95
ROW20 73 74 78 80 81 83 84

In case data is misaligned: Row 19, Column B, C, D, E, F, G, and H houses
70, 72, 87, 88, 89, 92 and 95 respectively. Row 20, Column C, D, E, F, G,
and H houses 73 74, 78, 80, 81, 83 and 84 respectively.

New Worksheet (for Expected Results)
ROW1 Input cells: B$1, C$1, D$1, E$1, F$1, G$1, H$1, I$1, J$1, K$1
80 81 82 83 84 85 86 87 88 89

In case data is misaligned: cell B1, C1, D1, E1, F1, G1, H1, I1, J1 and K1
house 80, 81, 82, 83, 84, 85, 86, 87, 88 and 89

Expected Results:
COL B C D E F G H I J K
ROW19 88 89
ROW20 83 84

Row19 – 88 and 89 returned in columns J and K
Row20 – 83 and 84 returned in columns E and F

Kind Regards,
Sam