=index(indirect....)

rob1987

New Member
Joined
Feb 14, 2011
Messages
39
Hello,

Simple question I think...

I am using the following formula to produce a list of names in C based on either PO, PM or BA being entered in cell A1:

=INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1))

However the names ranges PO,PM and BA are all different lengths, as I'm dragging the forumal down to cover enough cells for the longest range, BA, when I select the shortest, PO, I am getting 0 appear in the rest of the empty cells.

Is there anyway around this please?

Thanks for your help
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi, they are just first names: John, James, Dave, etc...

There are 7 in the named range PO, 8 in the named range PM and 11 in the named range BA.

So if i select PO in A1 I am getting my list of 7 names but then th next 4 cells all contain 0
 
Upvote 0
maybe the below would work. I think you need to handle empty cells in the named range and rolling past the length of the named range itself.

=IFERROR(IF(INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1))="","",INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1))),"")

or

=IF(ISERROR(INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1))),"",IF(INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1))="","",INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1))))
 
Upvote 0
if I am understanding you right you just dont want to see the zero's

try

=If(INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1))=0,"",INDEX(INDIRECT($A$1),ROW(A1),COLUMN(A1)))
 
Upvote 0
Unashamedly stealing Barry Houdini and rorys example as a means of understanding it

Excel Workbook
BCD
27POBAPM
28johnstephpolly
29allansallypauline
30davesimonechristine
31sallyshirley
32simonewillie
33colin
34tom
35tony
36
37BA
38polly
39pauline
40christine
41
42
43
44
Sheet1



Excel Workbook
BCD
27POBAPM
28johnstephpolly
29allansallypauline
30davesimonechristine
31sallyshirley
32simonewillie
33colin
34tom
35tony
36
37PM
38steph
39sally
40simone
41shirley
42willie
43colin
44tom
Sheet1
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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