Index function with text instead of numbers?

Stevee_p

New Member
Joined
Apr 28, 2011
Messages
4
Hi, I hope someone can help with this issue im having, its driving me nuts!

I am using the INDEX function to find a specific value within a table, but the column and rows I need to reference have names, rather than numerical values eg the tables columns are titled 55, 63, 75, 90 etc etc (not ascending order, but random other than that) and the rows are named
LPsdr11
LPsdr17.6
MPsdr11
MPsdr17.6 etc etc.

When I use the index function, it does not work, yet if I replace each column / row name with a number (1,2,3,4,5 etc) then the formula works.

Can anyone help? Perhaps I need a different formula / function?

Thanks in advance
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi Stevee_p,
Can you please share sample data and describe more on how you are using INDEX function?

Regards,
Kunal

Hi Kunal,

sample data is all numbers:

55 63 75 90 110 125 140 160
LPsdr11 2.88 3.78 5.40 7.74 11.52 14.76 18.54 24.30
LPsdr17.6 3.24 4.32 6.12 9.00 13.32 17.28 21.60 28.26
MPsdr11 2.52 3.24 4.68 6.66 10.08 12.96 16.38 21.24
MPsdr17.6 2.88 3.96 5.58 7.92 11.88 15.30 19.08 25.05
MPsdr21 3.06 3.96 5.76 8.28 12.24 15.84 19.98 26.10
MPsdr26 3.24 4.14 5.94 8.64 12.78 16.56 20.70 27.18
IP6/4sdr11 na 3.24 4.50 6.48 9.54 12.42 15.66 20.34
IP7/5.5sdr11 3.24 4.14 5.94 8.64 12.78 16.56 20.70 27.18
IP7/7sdr11 na 6.66 9.36 13.50 19.98 25.92 32.40 42.48

Apologies for the layout of the above, I cannot seem to add a table.

The column names can be seen as 55, 63, 75, 90 etc
and the row names as LPsdr 11 etc.

The data is all the figures with decimal points.

Does this help?
 
Upvote 0
Would this work for you ?


Excel Workbook
ABCDEFGHI
155637590110125140160
2LPsdr112.883.785.47.7411.5214.7618.5424.3
3LPsdr17.63.244.326.12913.3217.2821.628.26
4MPsdr112.523.244.686.6610.0812.9616.3821.24
5MPsdr17.62.883.965.587.9211.8815.319.0825.05
6MPsdr213.063.965.768.2812.2415.8419.9826.1
7MPsdr263.244.145.948.6412.7816.5620.727.18
8IP6/4sdr11na3.244.56.489.5412.4215.6620.34
9IP7/5.5sdr113.244.145.948.6412.7816.5620.727.18
10IP7/7sdr11na6.669.3613.519.9825.9232.442.48
11
12
13Drop down list for column heading90
14Drop down list for row headingMPsdr11
15
16Result for :
17RowColumnResult
18MPsdr11906.66
Sheet7
#VALUE!
 
Upvote 0
Hi Stevee_p,

For creating a UDF you need to press ALT + F11 in you sheet then double click on module1 and paste the below code

Code:
Function INDEX1(r As Range, col As String, row As String)
Dim column_var
Dim row_var
For Each I In r
    If col = I Then
        column_var = I.Column
    End If
Next
For Each I In r
    If row = I Then
        row_var = I.row
    End If
Next
INDEX1 = Sheet1.Cells(row_var, column_var)
End Function

Next in your sheet use the below function as below:

Code:
=index1(A1:I10,"55","LPsdr11")

The function accepts range as first parameter , column and row as second and third param respectively..
 
Upvote 0
Snoopyhr,

That worked perfectly, thank you very much! What's more, I understand the logic behind it. thanks again.

Steve
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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