How to pull first number in a series, based on group

kbianco

New Member
Joined
Aug 9, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi! I am hoping for some help with the following. I'd like be able to return a price (column A) for the first row within a given group to a certain threshold (column C). In the attached, i'd like a code that returns the first % change that is below -10%. Then continue on to look at the next group.

For example, looking at the orange group we want to identify the orange cell. In the yellow group, we want to identify the yellow cell. Note, i copied the below table over from my spreadsheet.

Any thoughts?

Thanks!


PriceGroup%% filter
19.26Red0%0%
19.4Orange0%0%
19.25Orange-1%0%
18.98Orange-2%0%
18.93Orange-2%0%
18.97Orange-2%0%
18.92Orange-2%0%
18.83Orange-3%0%
19Orange-2%0%
19.16Orange-1%0%
19.14Orange-1%0%
18.11Orange-7%0%
17.91Orange-8%0%
18.11Orange-7%0%
17.44Orange-10%-10%
17.69Orange-9%0%
17.64Orange-9%0%
17.81Orange-8%0%
17.91Orange-8%0%
17.67Orange-9%0%
17.59Orange-9%0%
17.32Orange-11%-11%
16.87Orange-13%-13%
16.69Orange-14%-14%
16.87Orange-13%-13%
16.68Orange-14%-14%
17.06Orange-12%-12%
17.36Orange-11%-11%
17.61Orange-9%0%
17.59Orange-9%0%
48.56Yellow-2%0%
48.61Yellow-2%0%
48.61Yellow-2%0%
48.45Yellow-3%0%
47.92Yellow-4%0%
47.92Yellow-4%0%
47.91Yellow-4%0%
47.79Yellow-4%0%
47.68Yellow-4%0%
47.26Yellow-5%0%
46.67Yellow-6%0%
47.03Yellow-5%0%
46.9Yellow-6%0%
46.92Yellow-6%0%
46.33Yellow-7%0%
46.3Yellow-7%0%
45.73Yellow-8%0%
45.75Yellow-8%0%
45.83Yellow-8%0%
44.91Yellow-9.7%0%
45.29Yellow-9%0%
45.49Yellow-9%0%
45.16Yellow-9%0%
44.51Yellow-11%-11%
43.89Yellow-12%-12%
44.61Yellow-10%-10%
44.64Yellow-10%-10%
44.46Yellow-11%-11%
 
Hello, could you please describe how the output should look like? Is it a column D or just a list of group + value?
 
Upvote 0
conditional format
1 red
2 Orange
3 yelloww

ROW($A2)=MIN(IFERROR(ROW($A$2:$A$59)/((($B$2:$B$59=TRANSPOSE(INDEX(UNIQUE($B$2:$B$59),1)))*$D$2:$D$59)<>0),""))

hhhhhh.xlsx
ABCD
1PriceGroup%% filter
219.3Red0%0%
319.4Orange0%0%
419.3Orange-1%0%
519Orange-2%0%
618.9Orange-2%0%
719Orange-2%0%
818.9Orange-2%0%
918.8Orange-3%0%
1019Orange-2%0%
1119.2Orange-1%0%
1219.1Orange-1%0%
1318.1Orange-7%0%
1417.9Orange-8%0%
1518.1Orange-7%0%
1617.4Orange-10%-10%
1717.7Orange-9%0%
1817.6Orange-9%0%
1917.8Orange-8%0%
2017.9Orange-8%0%
2117.7Orange-9%0%
2217.6Orange-9%0%
2317.3Orange-11%-11%
2416.9Orange-13%-13%
2516.7Orange-14%-14%
2616.9Orange-13%-13%
2716.7Orange-14%-14%
2817.1Orange-12%-12%
2917.4Orange-11%-11%
3017.6Orange-9%0%
3117.6Orange-9%0%
3248.6Yellow-2%0%
3348.6Yellow-2%0%
3448.6Yellow-2%0%
3548.5Yellow-3%0%
3647.9Yellow-4%0%
3747.9Yellow-4%0%
3847.9Yellow-4%0%
3947.8Yellow-4%0%
4047.7Yellow-4%0%
4147.3Yellow-5%0%
4246.7Yellow-6%0%
4347Yellow-5%0%
4446.9Yellow-6%0%
4546.9Yellow-6%0%
4646.3Yellow-7%0%
4746.3Yellow-7%0%
4845.7Yellow-8%0%
4945.8Yellow-8%0%
5045.8Yellow-8%0%
5144.9Yellow-9.70%0%
5245.3Yellow-9%0%
5345.5Yellow-9%0%
5445.2Yellow-9%0%
5544.5Yellow-11%-11%
5643.9Yellow-12%-12%
5744.6Yellow-10%-10%
5844.6Yellow-10%-10%
5944.5Yellow-11%-11%
ورقة2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:D59Expression=ROW($A2)=MIN(IFERROR(ROW($A$2:$A$59)/((($B$2:$B$59=TRANSPOSE(INDEX(UNIQUE($B$2:$B$59),3)))*$D$2:$D$59)<>0),""))textNO
A2:D59Expression=ROW($A2)=MIN(IFERROR(ROW($A$2:$A$59)/((($B$2:$B$59=TRANSPOSE(INDEX(UNIQUE($B$2:$B$59),2)))*$D$2:$D$59)<>0),""))textNO
A2:D59Expression=ROW($A2)=MIN(IFERROR(ROW($A$2:$A$59)/((($B$2:$B$59=TRANSPOSE(INDEX(UNIQUE($B$2:$B$59),1)))*$D$2:$D$59)<>0),""))textNO
 
Upvote 0
I'd like be able to return a price (column A) for the first row within a given group to a certain threshold (column C). In the attached, i'd like a code that returns the first % change that is below -10%. Then continue on to look at the next group.

For example, looking at the orange group we want to identify the orange cell. In the yellow group, we want to identify the yellow cell.

Something like this?

25 03 21.xlsm
ABCDEFG
1PriceGroup%% filterPriceGroup
219.26Red0%0%-Red
319.4Orange0%0%17.44Orange
419.25Orange-1%0%44.51Yellow
518.98Orange-2%0%
618.93Orange-2%0%
718.97Orange-2%0%
818.92Orange-2%0%
918.83Orange-3%0%
1019Orange-2%0%
1119.16Orange-1%0%
1219.14Orange-1%0%
1318.11Orange-7%0%
1417.91Orange-8%0%
1518.11Orange-7%0%
1617.44Orange-10%-10%
1717.69Orange-9%0%
1817.64Orange-9%0%
1917.81Orange-8%0%
2017.91Orange-8%0%
2117.67Orange-9%0%
2217.59Orange-9%0%
2317.32Orange-11%-11%
2416.87Orange-13%-13%
2516.69Orange-14%-14%
2616.87Orange-13%-13%
2716.68Orange-14%-14%
2817.06Orange-12%-12%
2917.36Orange-11%-11%
3017.61Orange-9%0%
3117.59Orange-9%0%
3248.56Yellow-2%0%
3348.61Yellow-2%0%
3448.61Yellow-2%0%
3548.45Yellow-3%0%
3647.92Yellow-4%0%
3747.92Yellow-4%0%
3847.91Yellow-4%0%
3947.79Yellow-4%0%
4047.68Yellow-4%0%
4147.26Yellow-5%0%
4246.67Yellow-6%0%
4347.03Yellow-5%0%
4446.9Yellow-6%0%
4546.92Yellow-6%0%
4646.33Yellow-7%0%
4746.3Yellow-7%0%
4845.73Yellow-8%0%
4945.75Yellow-8%0%
5045.83Yellow-8%0%
5144.91Yellow-9.70%0%
5245.29Yellow-9%0%
5345.49Yellow-9%0%
5445.16Yellow-9%0%
5544.51Yellow-11%-11%
5643.89Yellow-12%-12%
5744.61Yellow-10%-10%
5844.64Yellow-10%-10%
5944.46Yellow-11%-11%
kbianco
Cell Formulas
RangeFormula
F2:G4F2=LET(g,B2:B59,u,UNIQUE(g),HSTACK(BYROW(u,LAMBDA(r,TAKE(FILTER(A2:A59,(g=r)*(C2:C59<=-0.1),"-"),1))),u))
Dynamic array formulas.
 
Upvote 0
Solution
Something like this?

25 03 21.xlsm
ABCDEFG
1PriceGroup%% filterPriceGroup
219.26Red0%0%-Red
319.4Orange0%0%17.44Orange
419.25Orange-1%0%44.51Yellow
518.98Orange-2%0%
618.93Orange-2%0%
718.97Orange-2%0%
818.92Orange-2%0%
918.83Orange-3%0%
1019Orange-2%0%
1119.16Orange-1%0%
1219.14Orange-1%0%
1318.11Orange-7%0%
1417.91Orange-8%0%
1518.11Orange-7%0%
1617.44Orange-10%-10%
1717.69Orange-9%0%
1817.64Orange-9%0%
1917.81Orange-8%0%
2017.91Orange-8%0%
2117.67Orange-9%0%
2217.59Orange-9%0%
2317.32Orange-11%-11%
2416.87Orange-13%-13%
2516.69Orange-14%-14%
2616.87Orange-13%-13%
2716.68Orange-14%-14%
2817.06Orange-12%-12%
2917.36Orange-11%-11%
3017.61Orange-9%0%
3117.59Orange-9%0%
3248.56Yellow-2%0%
3348.61Yellow-2%0%
3448.61Yellow-2%0%
3548.45Yellow-3%0%
3647.92Yellow-4%0%
3747.92Yellow-4%0%
3847.91Yellow-4%0%
3947.79Yellow-4%0%
4047.68Yellow-4%0%
4147.26Yellow-5%0%
4246.67Yellow-6%0%
4347.03Yellow-5%0%
4446.9Yellow-6%0%
4546.92Yellow-6%0%
4646.33Yellow-7%0%
4746.3Yellow-7%0%
4845.73Yellow-8%0%
4945.75Yellow-8%0%
5045.83Yellow-8%0%
5144.91Yellow-9.70%0%
5245.29Yellow-9%0%
5345.49Yellow-9%0%
5445.16Yellow-9%0%
5544.51Yellow-11%-11%
5643.89Yellow-12%-12%
5744.61Yellow-10%-10%
5844.64Yellow-10%-10%
5944.46Yellow-11%-11%
kbianco
Cell Formulas
RangeFormula
F2:G4F2=LET(g,B2:B59,u,UNIQUE(g),HSTACK(BYROW(u,LAMBDA(r,TAKE(FILTER(A2:A59,(g=r)*(C2:C59<=-0.1),"-"),1))),u))
Dynamic array formulas.


This is exactly what i need, thank you! do you mind sharing what the lower case letters reference? sorry i am not familair with the functions you are using.
 
Upvote 0
@kbianco In future please mark the post that contains the solution, rather than your post saying it works.
I have changed it for you this time.
 
Upvote 0
Here is an option I created earlier but got interrupted with work..
Excel Formula:
=LET(r,A2:C59,d,FILTER(r,INDEX(r,,3)<=-0.1),g,INDEX(d,,2),u,UNIQUE(g),HSTACK(XLOOKUP(u,g,g),XLOOKUP(u,g,INDEX(d,,1))))
 
Upvote 0
This is exactly what i need, thank you!
You're welcome. Thanks for the follow-up. :)

do you mind sharing what the lower case letters reference?
The lower case letters (they don't have to be lower case) are names (like variables) that hold intermediate results that are used later (possibly multiple times) in the formula.
See the Help on the LET function for more information.
 
Upvote 0

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