How to find all the cells in a particular column when other column meets a condition?

rooigle

New Member
Joined
Dec 24, 2018
Messages
5
Hello members of Mr Excel,

My puzzle presents as follows ...


I have a table that looks pretty much like the following in a sample version:


[TABLE="width: 832"]
<tbody>[TR]
[TD="width: 64"]Date[/TD]
[TD="width: 64"]1 MO[/TD]
[TD="width: 64"]2 MO[/TD]
[TD="width: 64"]3 MO[/TD]
[TD="width: 64"]6 MO[/TD]
[TD="width: 64"]1 YR[/TD]
[TD="width: 64"]2 YR[/TD]
[TD="width: 64"]3 YR[/TD]
[TD="width: 64"]5 YR[/TD]
[TD="width: 64"]7 YR[/TD]
[TD="width: 64"]10 YR[/TD]
[TD="width: 64"]20 YR[/TD]
[TD="width: 64"]30 YR[/TD]
[/TR]
[TR]
[TD="class: xl63"]########[/TD]
[TD]2.41[/TD]
[TD]2.42[/TD]
[TD]2.39[/TD]
[TD]2.54[/TD]
[TD]2.62[/TD]
[TD]2.63[/TD]
[TD]2.61[/TD]
[TD]2.64[/TD]
[TD]2.72[/TD]
[TD]2.79[/TD]
[TD]2.92[/TD]
[TD]3.03[/TD]
[/TR]
[TR]
[TD="class: xl63"]########[/TD]
[TD]2.31[/TD]
[TD]2.33[/TD]
[TD]2.37[/TD]
[TD]2.52[/TD]
[TD]2.7[/TD]
[TD]2.8[/TD]
[TD]2.83[/TD]
[TD]2.84[/TD]
[TD]2.92[/TD]
[TD]3.01[/TD]
[TD]3.19[/TD]
[TD]3.3[/TD]
[/TR]
[TR]
[TD="class: xl63"]########[/TD]
[TD]2.2[/TD]
[TD]2.26[/TD]
[TD]2.34[/TD]
[TD]2.49[/TD]
[TD]2.69[/TD]
[TD]2.87[/TD]
[TD]2.93[/TD]
[TD]2.98[/TD]
[TD]3.07[/TD]
[TD]3.15[/TD]
[TD]3.3[/TD]
[TD]3.39[/TD]
[/TR]
[TR]
[TD="class: xl63"]########[/TD]
[TD]2.12[/TD]
[TD][/TD]
[TD]2.19[/TD]
[TD]2.36[/TD]
[TD]2.59[/TD]
[TD]2.81[/TD]
[TD]2.88[/TD]
[TD]2.94[/TD]
[TD]3.01[/TD]
[TD]3.05[/TD]
[TD]3.13[/TD]
[TD]3.19[/TD]
[/TR]
[TR]
[TD="class: xl63"]########[/TD]
[TD]1.95[/TD]
[TD][/TD]
[TD]2.11[/TD]
[TD]2.28[/TD]
[TD]2.46[/TD]
[TD]2.62[/TD]
[TD]2.7[/TD]
[TD]2.74[/TD]
[TD]2.81[/TD]
[TD]2.86[/TD]
[TD]2.95[/TD]
[TD]3.02[/TD]
[/TR]
[TR]
[TD="class: xl63"]########[/TD]
[TD]1.94[/TD]
[TD][/TD]
[TD]2.03[/TD]
[TD]2.21[/TD]
[TD]2.44[/TD]
[TD]2.67[/TD]
[TD]2.77[/TD]
[TD]2.85[/TD]
[TD]2.92[/TD]
[TD]2.96[/TD]
[TD]3.03[/TD]
[TD]3.08[/TD]
[/TR]
[TR]
[TD="class: xl63"]########[/TD]
[TD]1.77[/TD]
[TD][/TD]
[TD]1.93[/TD]
[TD]2.11[/TD]
[TD]2.33[/TD]
[TD]2.52[/TD]
[TD]2.63[/TD]
[TD]2.73[/TD]
[TD]2.81[/TD]
[TD]2.85[/TD]
[TD]2.91[/TD]
[TD]2.98[/TD]
[/TR]
</tbody>[/TABLE]


Basically, I want two things:

1. To return in successive rows (single column) the dates that correspond to those raw wherein the value in column 5 YR was greater than that in column 7 YR.

2. (related to the previous) To return in a single cell, the count of the number of rows wherein (again) the value in column 5 YR was greater than that in column 7 YR.


I think that the idea it's simple but I cannot get my head around it. I have been trying VLOOKUP, INDEX, MATH, COUNTIF, etc, but I was unsuccessful to date.


Thank you for your help! :)
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
How about

Excel 2013/2016
ABCDEFGHIJKLMNOP
1Date1 MO2 MO3 MO6 MO1 YR2 YR3 YR5 YR7 YR10 YR20 YR30 YR
201/12/20182.412.422.392.542.622.632.612.642.722.792.923.0303/12/20182
302/12/20182.312.332.372.522.72.82.832.842.923.013.193.306/12/2018
403/12/20182.22.262.342.492.692.872.933.93.073.153.33.39
504/12/20182.122.192.362.592.812.882.943.013.053.133.19
605/12/20181.952.112.282.462.622.72.742.812.862.953.02
706/12/20181.942.032.212.442.672.772.852.652.963.033.08
807/12/20181.771.932.112.332.522.632.732.812.852.912.98
Sheet4
Cell Formulas
RangeFormula
O2{=IFERROR(INDEX($A$2:$A$8,SMALL(IF($I$2:$I$8>$J$2:$J$8,ROW($A$2:$A$8)-ROW($A$2)+1),ROWS($1:1))),"")}
P2{=SUM(--(I2:I8>J2:J8))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Dear Fluff,


First of all, thanks for your quick reply!

I have been able to make the second formula work (=SUM...) but the first one yields me the same date (the first date when the condition is met) in all the cells that I target the array formula to. Any idea of what may I be doing wrong?


Thank you for your help!
 
Upvote 0
Are your dates actual dates, rather than text values?
Also are they dates or date & time?
 
Upvote 0
[TABLE="width: 604"]
<tbody>[TR]
[TD="colspan: 2"]Just to be more specific I copy the table wherein I am using now, plus the formula.


Formula (using it properly as an array function):

{=IFERROR(INDEX($A$7:$A$49,SMALL(IF($B$7:$B$49>$C$7:$C$49,ROW($A$7:$A$49)-ROW($A$7)+1),ROWS($7:7))),"")}


Table (wherein "2008 Quarter 1" is in cell A7 and the table ends in A49):


NATIONAL DELINQUENCY RATES[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Quarter[/TD]
[TD]Percent Delinquent
90 Days or More[/TD]
[TD]Percent Delinquent
30 or 60 Days[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2008 Quarter 1[/TD]
[TD]2.1[/TD]
[TD]3.1[/TD]
[TD]2009 Quarter 2[/TD]
[/TR]
[TR]
[TD]2008 Quarter 2[/TD]
[TD]2.4[/TD]
[TD]2.8[/TD]
[TD]2009 Quarter 2[/TD]
[/TR]
[TR]
[TD]2008 Quarter 3[/TD]
[TD]2.5[/TD]
[TD]2.8[/TD]
[TD]2009 Quarter 2[/TD]
[/TR]
[TR]
[TD]2008 Quarter 4[/TD]
[TD]3.0[/TD]
[TD]3.3[/TD]
[TD]2009 Quarter 2[/TD]
[/TR]
[TR]
[TD]2009 Quarter 1[/TD]
[TD]3.7[/TD]
[TD]3.8[/TD]
[TD]2009 Quarter 2[/TD]
[/TR]
[TR]
[TD]2009 Quarter 2[/TD]
[TD]4.3[/TD]
[TD]3.3[/TD]
[TD]2009 Quarter 2[/TD]
[/TR]
[TR]
[TD]2009 Quarter 3[/TD]
[TD]4.9[/TD]
[TD]3.3[/TD]
[TD]2009 Quarter 2[/TD]
[/TR]
[TR]
[TD]2009 Quarter 4[/TD]
[TD]5.4[/TD]
[TD]3.5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2010 Quarter 1[/TD]
[TD]5.9[/TD]
[TD]3.6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2010 Quarter 2[/TD]
[TD]6.0[/TD]
[TD]3.1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]...[/TD]
[TD]...[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


The formula has been applied on the far-right column and, as you can see, it constantly renders the same output.
 
Upvote 0
Not sure why it's doing that as it works for me


Excel 2013/2016
ABCD
6QuarterPercent Delinquent 90 Days or MorePercent Delinquent 30 or 60 Days
72008 Quarter 22.42.82009 Quarter 2
82008 Quarter 32.52.82009 Quarter 3
92008 Quarter 433.32009 Quarter 4
102009 Quarter 13.73.82010 Quarter 1
112009 Quarter 24.33.32010 Quarter 2
122009 Quarter 34.93.3
132009 Quarter 45.43.5
142010 Quarter 15.93.6
152010 Quarter 263.1
Sheet4
Cell Formulas
RangeFormula
D7{=IFERROR(INDEX($A$7:$A$49,SMALL(IF($B$7:$B$49>$C$7:$C$49,ROW($A$7:$A$49)-ROW($A$7)+1),ROWS($7:7))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Right, I now know what I was doing wrong. I was using it over several rows at the same time thinking that I had to do so since it was an array. Apparently I just had to drag it down from the first row.

Your formula works impeccably. Thank you Fluff!
 
Upvote 0
Glad you sorted it out & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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