Help with formula using Sumproduct, Sign, and Index

mArkcpp

Board Regular
Joined
Aug 8, 2002
Messages
67
Office Version
  1. 365
Hello. I have a question building on some of the help I've received here a month or so ago.

I have some data that looks something like:

Row 1: P-150, P-150, P-150, P-150, P-150, P-150, P-150, P-150, P-150, P-100, P-100, P-100
Row 2: , P, D, D, 1, 1, 2, 2, 2, , P, 1
Row 3: U, U, U, U, D, 125, U, D, 150, U, U, 50
Row 4: 100, 175, 166, 160, 154, 130, 160, 158, 151, 25, 75, 54
Row 5: 105, 166, 160, 154, 130, 125, 158, 151, 150, 26, 70, 50


Cell A8 = P-150
Cell A9 = 1

Formula in Cell A13 through A30 =

=IF((ROW() - 12)>SUMPRODUCT(SIGN(($A$2:$L$2=$A$9)+($A$2:$L$2="")+($A$2:$L$2="P")+($A$2:$L$2="D")),--($A$1:$L$1=$A$8))+1,"",INDEX($4:$4,SMALL(IF(($A$1:$L$1=$A$8)*SIGN(($A$2:$L$2=$A$9)+($A$2:$L$2="")+($A$2:$L$2="P")+($A$2:$L$2="D")),COLUMN($A$2:$L$2),""),ROW()-12)))

Results look like:

100
175
166
160
154
130
(now a bunch of empty cells)

This works exactly like I had hoped; however, now I would like to complicate the formula a little more. I would like one more number to be pulled after the 130. I would like that number to be the number in row 5 corresponding to the last value pulled (i.e. 130 was last number, and 125 is in the same column one row down, so pull 125.

The results would read:
100
175
166
160
154
130
125

Can anyone help with this new task?

I started adjusting the formula to this point:

=IF((ROW() - 12)>SUMPRODUCT(SIGN(($A$2:$L$2=$A$9)+($A$2:$L$2="")+($A$2:$L$2="P")+($A$2:$L$2="D")),--($A$1:$L$1=$A$8))+1,"",IF((ROW() - 12)<SUMPRODUCT(SIGN(($A$2:$L$2=$A$9)+($A$2:$L$2="")+($A$2:$L$2="P")+($A$2:$L$2="D")),--($A$1:$L$1=$A$8))+1,INDEX($4:$4,SMALL(IF(($A$1:$L$1=$A$8)*SIGN(($A$2:$L$2=$A$9)+($A$2:$L$2="")+($A$2:$L$2="P")+($A$2:$L$2="D")),COLUMN($A$2:$L$2),""),ROW()-12)),"new number here"))

I've replaced "new number here" with a few tries but have not had any success pulling the formula.

I can send the excel file if needed.

Thanks for any help.

Mark
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try...

=SUM(IF(A1:L1=A8,IF((A2:L2="D")+(ISNUMBER(SEARCH(","&A9&",",","&A2:L2&","))),A6:L6)))

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!
 
Upvote 0
Domenic, this appears to work perfect.

Thanks to you and Tony for the help!! I certainly appreciate it.

Mark
 
Upvote 0

Forum statistics

Threads
1,215,459
Messages
6,124,946
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top