Pick the row number from the cell value.

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,362
Office Version
  1. 2010
Using Excel 2010

Hello,

I am using following array formula which is as below

Rich (BB code):
{=IF(MAX(($GI6=$D$6:$D$4108)*(ROW($D$6:$D$4108)))=0,,MAX(($GI6=$D$6:$D$4108)*(ROW($D$6:$D$4108))))}

Where I am using range $D$6:$D$4108 direct in the formula but I need to pick row number from the cell A1 and A2 for example cell value A1=6 and A2=250 is it possible. So it would be range actually $D$6:$D$250

Please help

Thank you all.

Regards,
Moti
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
@motilulla You can express your variable ranges using either INDIRECT or OFFSET functions.
INDIRECT is volatile so perhaps best to use OFFSET

Below are examples as used in a simple SUM formula.

Book2
ABCD
161
2152
33
41054
51055
66
77
88
99
1010
1111
1212
1313
1414
1515
1616
1717
1818
1919
2020
2121
2222
2323
2424
2525
2626
2727
Sheet3
Cell Formulas
RangeFormula
A4A4=SUM(INDIRECT("$D$"&$A$1&":$D$"&$A$2))
A5A5=SUM(OFFSET($D$1,$A$1-1,,$A$2-$A$1+1))


Hope that helps.
 
Upvote 0
Solution
@motilulla You can express your variable ranges using either INDIRECT or OFFSET functions.
INDIRECT is volatile so perhaps best to use OFFSET

Below are examples as used in a simple SUM formula.

Book2
ABCD
161
2152
33
41054
51055
66
77
88
99
1010
1111
1212
1313
1414
1515
1616
1717
1818
1919
2020
2121
2222
2323
2424
2525
2626
2727
Sheet3
Cell Formulas
RangeFormula
A4A4=SUM(INDIRECT("$D$"&$A$1&":$D$"&$A$2))
A5A5=SUM(OFFSET($D$1,$A$1-1,,$A$2-$A$1+1))


Hope that helps.
Snakehips, when I applied INDIRECT or OFFSET functions with my formula it seems both functions are volatile as I find INDIRECT bit easier, so I used the INDIRECT. It results ideal!

Thank you so much for your help

Good Luck

Kind Regards,
Moti :)
 
Upvote 0
@motilulla Pleased to have helped.
I should have realised that Indirect was also volatile.:rolleyes:

You can use INDEX which is not. eg
Excel Formula:
=SUM(INDEX(D:D,$A$1,):INDEX(D:D,$A$2,))
 
Upvote 0
@motilulla Pleased to have helped.
I should have realised that Indirect was also volatile.:rolleyes:

You can use INDEX which is not. eg
Excel Formula:
=SUM(INDEX(D:D,$A$1,):INDEX(D:D,$A$2,))
Snakehips, thank you for giving an option of non-volatile function this worked fine.

Have a great weekend, Good Luck

Kind Regards,
Moti
 
Upvote 0

Forum statistics

Threads
1,215,149
Messages
6,123,311
Members
449,095
Latest member
Chestertim

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