Excel formula for variable number of columns

pjindent

New Member
Joined
Jan 25, 2012
Messages
4
I am looking to place a formula which will look like this:

=min("A2:?2"), where ? depends on "number of columns". If number of columns is 4, then it should be D, E or Z. Number of columns is specified as an integer in range("B2").

I do not want to do it in a macro, want to do it in the formula.

I have done this before, but can't quite remember. I have tried:

=min(range(cells(1,2),cells(1,2+B2))), but does not work.

Help would be appreciated.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try
=MIN(OFFSET(A2,0,0,1,B2))

If number of columns is 4, then it should be D, E or Z.
Why is it D, E or Z? Wouldn't it be D?
Also, B2 is in the range A2:D2, etc. Is this intentional?
 
Upvote 0
that works.:)
Thanks for bearing with multiple mistakes in my question.

I am rewording the question so others can benefit. Answer to this question is in the previous message.

I am looking to place a formula which will look like this:

=min("A2:?2"), where ? depends on "number of columns". If number of columns is 4, then it should be D. Number of columns is specified as an integer in range("A3").

I do not want to do it in a macro, want to do it in the formula.

I have done this before, but can't quite remember. I have tried:

=min(range(cells(2,1),cells(2,1+A3))), but does not work.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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