# Select range based on cell content

#### tizdall

##### New Member
Hello!

I am trying to find a CSE formula (not sure if I need to do this in VBA?) where I can select a range of data in a column based on fixed first cell in the column but the last point is dynamic depending on the user input.

For example:

 Column A Column B R1 R2 R3 R4 10 R5 3 R6 0 R7 5 R8 8 R9 28 R10 R11 R12 R13

<tbody>
</tbody>

So I know that my first point will be R4 Column B but in each case the end point might be R10 in one case, R100 in another. The end result is that I want to report the minimum value in this range but I'm not sure how to specify this open ended range as a CSE formula..?

so far what I have is:

{=If(Min(B4:B9<>0|B4:B9))}

I am trying to figure out a replacement for the "B9" so that it locates the last cell from B4 that has data and then find the (non-zero) minimum in that range.

Any help would be appreciated!

### Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi,

Try,

=MIN(B4:OFFSET(B4,COUNT(B4:B1000)-1,0))

Array formula. To be confirmed with CTRL + SHIFT + ENTER.

Jai

Yeah, works great!

Thanks!

Let's say I have the following:

 Min B Min P Type Value B 170 P 150 P 151 B 181 B 100 P 101

<tbody>
</tbody>

I am using the first part as my minimum finder within the range, is it possible to attribute the minimum value of the "B's" within my data range to the Min B cell and vice versa for the P value? Essentially find the minimum of each type (B or P) depending on what the cell adjacent to it is specifying? It would only be 2 types in the adjacent cells, B or P but mixed and matched within the data range as shown in the table and in no particular order.

Again, thanks for the help before, any additional help would be appreciated!!

Replies
9
Views
211
Replies
3
Views
168
Replies
18
Views
487
Replies
8
Views
296
Replies
2
Views
296

1,207,169
Messages
6,076,908
Members
446,239
Latest member
Home Nest

### 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.

### Which adblocker are you using?

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

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