Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Converting this sample in to a vba for excel

  Asked By: Mona    Date: Sep 14    Category: MS Office    Views: 924
  

I have something similar like below.



In where, I have a name and values representing that name across the row.



I now need to work out a some code, with your help to do the same but based
on the name pass to it via a string and then the column of what data I
require.



Ie.



GetDataFromTable("Henry, Age)

So it return the value 28



As I tried to use the index and match function but this seem to only in a
worksheet



I could really make use of decent vba function that would assist me in
this..



Example



Use the INDEX function and the MATCH function to look up data

Assume that you create the following table of information in cells A1:C5 and
that this table contains age information in cells C1:C5:







Assume that you want to look up the age of a person by using the person's
name. To do this, use a combination of the INDEX function and the MATCH
function as in the following sample formula:

=INDEX($A$1:$C$5, MATCH("Mary",$A$1:$A$5,),3)

This sample formula uses cells A1:C5 as the table and looks up Mary's age in
the third column. The formula returns 22.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Estella Mitchell     Answered On: Sep 14

It sounds as though you need to use Vlookup.

 
Didn't find what you were looking for? Find more on Converting this sample in to a vba for excel Or get search suggestion and latest updates.




Tagged: