Creating Range with a Variable Starting Point

ChrisRRR

New Member
Joined
May 16, 2016
Messages
30
I am trying to eliminate volatile/single thread functions to make my sheet run faster. The transition is proving difficult in many aspects for me.

I have many numeric values that are variable in Col B up to row 214. They continuously descend in value. An entry can be made that will add to a cell in Col B, but the numbers will still continuously descend afterwards.

A1 contains the number 140. I am waiting for the numbers in Col B to drop just below A1.

After an entry is made that causes an addition in a Col B cell, there is no way to determine how long it will take for the numbers to drop to A1.

Currently, I can get the row number of the last entry with this in cell A2. Col C determines when an addition is made to Col B.

A2=LOOKUP(2,1/(C5:C214<>""),ROW(B5:B214))


I can also get the value of the Col B cell after an addition with this A3=INDEX(B1:B214,A2)

My questions is how do I make a formula that will search Col B from the last time an addition was made to the end of Col B for a number just below A1? Note: It is possible for Col B to drop below A1 more than once, so it is important that this checks Col B after the last increase was made.
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I am not clear what you are trying to do, but it sounds as though it would be much easier to write a bit of VBA and put it in the worksheet change or the worksheet calculate event to do what you want. If the VBA is written properly it would be much faster than using worksheet functions. Without seeing your worksheet it is difficult to give any real assistance.
 
Upvote 0
I am not clear what you are trying to do, but it sounds as though it would be much easier to write a bit of VBA and put it in the worksheet change or the worksheet calculate event to do what you want. If the VBA is written properly it would be much faster than using worksheet functions. Without seeing your worksheet it is difficult to give any real assistance.


I'm not very well versed with VBA. I am in the process of teaching myself.

A1 is matched against Col B to return the first value lower. There are three values that match B5,B9,B13. I want B13 returned because there are no new entries past C11.
Notice that an entry in C results in an increase in B7 and B11.

All values are subject to change by the user as there is no pattern.

The formulas I posted earlier were my attempt to solve this issue. Inside A2, I put LOOKUP(2,1/(C5:C214<>""),ROW(B5:B214)) which returns 11. That is the last row an entry was made in C. Inside A3, I put INDEX(B1:B214,A2) which returns 176, also in row 11.

My thoughts were that I could create a range of B11 (11 because I can get that row number):B214. I'm not sure how I can create the range, but ultimately in this example below, I want a formula to return B13.


ABCD
1140514
2430
3315
4200
5139
6125
7343x
8203
9127
10115
11176x
12153
13135
14121
15118
1695
1785
1876
1954

<tbody>
</tbody>
 
Last edited:
Upvote 0
After some looking around on the internet, I found some threads that are about finding the last match in a range. The only problem is that they typically focus on words ort exact matches. This is different because an exact match is not possible. The next biggest value less than is what I'm looking for
 
Upvote 0
Not sure i understand what you are trying to do.

See if this does what you need

A
B
C
1
140​
514​
2
11​
430​
3
135​
315​
4
200​
5
139​
6
125​
7
343​
x​
8
203​
9
127​
10
115​
11
176​
x​
12
153​
13
135​
14
121​
15
118​
16
95​
17
85​
18
76​
19
54​
20

Formula in A2
=LOOKUP(2,1/(C1:C214="x"),ROW(B1:B214))

Formula in A3
=INDEX(B:B,MATCH(1,INDEX((A1>B1:B214)*(ROW(B1:B214)>A2),),0))

M.
 
Upvote 0
Not sure i understand what you are trying to do.

See if this does what you need



Formula in A2
=LOOKUP(2,1/(C1:C214="x"),ROW(B1:B214))

Formula in A3
=INDEX(B:B,MATCH(1,INDEX((A1>B1:B214)*(ROW(B1:B214)>A2),),0))

M.

Marcelo, thank you for coming to the rescue again. That is exactly what I needed. I'm not exactly sure how some of it works, but it does the trick
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,544
Members
449,316
Latest member
sravya

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