Finding second positive number in row

Tdorman

Board Regular
Joined
Aug 12, 2021
Messages
50
Office Version
  1. 2016
Platform
  1. Windows
The formula I used below allows me to find the first positive number in the row. I cant seem to get it to help me find the second positive number after. I would also need it to find the third, fourth, fifth, and so on.

=INDEX($J$8:$S$8,MATCH(1,INDEX(--($J$8:$S$8>0),1,0),0))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Are you still using xl2016?
 
Upvote 0
Ok, how about
Fluff.xlsm
JKLMNOPQRS
8-12-5364-5-6-410
9236410 
Data
Cell Formulas
RangeFormula
J9:O9J9=IFERROR(INDEX($J$8:$S$8,AGGREGATE(15,6,(COLUMN($J$8:$S$8)-COLUMN($J$8)+1)/($J$8:$S$8>0),COLUMNS($J9:J9))),"")
 
Upvote 0
Sorry for the confusion, below is the table that it needs to go into. The amounts below the year are what I'm looking to carry down. The first positive, in this case 1,000,000 goes against the first negative amount, (33,688,598). There's still an amount left over after the 1,000,000 is netted against that amount so the second positive amount, or 5,000,000, can go against that as well. These will be listed in the same column, so the 5,000,000 will go below the 1,000,000 in column J

CBT-100U Workpapers 6-5TEST.xlsm
JKLMNOPQRS
5
62009201020112012201320142015201620172018
7
8(33,688,598)(29,587,046)1,000,000(28,027,007)(15,752,937)(28,579,386)5,000,000(50,355,149)(43,146,535)(40,980,658)
91,000,000
10
11
12
13
14
15
16
NOL-TEMPLATE
Cell Formulas
RangeFormula
J8:K8,Q8:S8,M8:O8K8=-(IFERROR(INDEX('DATA 500U-P-22'!$G$12:$G$3000,MATCH(1,INDEX(('DATA 500U-P-22'!$C$12:$C$3000=$A$6)*(YEAR('DATA 500U-P-22'!$F$12:$F$2000)=K6),0),0),0),0))
J9J9=INDEX($J$8:$S$8,MATCH(1,INDEX(--($J$8:$S$8>0),1,0),0))
 
Upvote 0
I can never seem to get AGGREGATE to work for me like Fluff can. But, this is what I cam up with:

Book1
IJKLMNOPQRS
865-11-4-1-24-42
9
10
11
12
136
145
151
164
172
18 
19
20
Sheet1
Cell Formulas
RangeFormula
J13:J18J13=IFERROR(INDEX($J$8:$S$8,1/LARGE(1/(IFERROR((1/($J$8:$S$8>0))*(COLUMN($J$8:$S$8)-COLUMN($J$8)+1),9999)),IF(ROWS($J$13:J13)<=COUNTIF($J$8:$S$8,">0"),ROWS($J$13:J13)))),"")
 
Upvote 0
In that case how about
Fluff.xlsm
JKLMNOPQRS
5
62009201020112012201320142015201620172018
7
8-33,688,598-29,587,0461,000,000-28,027,007-15,752,937-28,579,3865,000,000-50,355,149-43,146,535-40,980,658
91,000,000
105,000,000
11 
12 
Data
Cell Formulas
RangeFormula
J9:J12J9=IFERROR(INDEX($J$8:$S$8,AGGREGATE(15,6,(COLUMN($J$8:$S$8)-COLUMN($J$8)+1)/($J$8:$S$8>0),ROWS(J$9:J9))),"")
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0
@Fluff is there anyway to have the formula not count any amount that had been used already? For instance, in this example, because the 1,000,000 and 5,000,000 were already used they cant then be used in any of the subsequent years.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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