Solved

Getting a value from an array?

Posted on 2014-07-31
6
95 Views
Last Modified: 2014-08-06
I have a value stored in a name called CH_FinGrp, in this case it is: X1, however X1 will refer to a value in a table on a sheet named: FinGrpFinUsedTable
How do I look down column A of the FinGrpFinUsedTable sheet to find the CH_FinGrp value, then grab the value in the cell to the right (offset one column right)
Then give that a name to use, like ActualFinishToUse = the result found?

So in my example, if X1 is the value of CH_FinGrp, it should return TR_E and assign that the name ActualFinishToUse
FinGrpFinishUsedTable.xlsx
0
Comment
Question by:RWayneH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 40231735
Hi,

pls try

CH_FinGrp = "X1"
ActualFinishToUse = WorksheetFunction.VLookup(CH_FinGrp, Range("A1:C18"), 2, 0)

Regards
0
 

Author Comment

by:RWayneH
ID: 40231827
Can this be made more dynamic?  Perhaps if I name the range ("A1::C18") to "FinGrpTable"  How would this change the way this looks?
0
 

Author Comment

by:RWayneH
ID: 40231865
ActualFinishToUse = WorksheetFunction.VLookup(CH_FinGrp, Range("A1:C18"), 2, 0)

is failing.  "unable to get vlookup property of the WorkSheetFunction class
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:RWayneH
ID: 40231918
Ok got this to work... now.  How do I remove absolute locations and use a name?
0
 
LVL 27

Assisted Solution

by:Glenn Ray
Glenn Ray earned 250 total points
ID: 40233434
If you're expecting the size of the table - currently in A1:C18 - to change, then I recommend you define it as a Table in Excel (Menu: Insert, Table...accept defaults).  The range will be named "Table1" by default; you can change that name in the Name Manager (Menu: Formulas, Name Manager).  Just highlight Table1, click Edit, then change the name (ex., FinGrpTable).

Then, in the VBA code you can replace any occurence of
A1:C18
with the new table name (ex., "FinGrpTable").

An Excel Table is very dynamic and the range will expand as needed when/if new rows are added.

Regards,
-Glenn
0
 

Author Closing Comment

by:RWayneH
ID: 40244340
Thanks for the help.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question