+ Reply to Thread
Results 1 to 4 of 4

Using multiple names and referring to names via cells; when tranferring btw 2 sheets

  1. #1
    Registered User
    Join Date
    02-10-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    2

    Red face Using multiple names and referring to names via cells; when tranferring btw 2 sheets

    Hi all,

    My Situation: I need to transfer a very large amount of data between two sheets.
    In the original sheet, the data is sorted into blocks of data, where each part is named (e.g. Netherlands_Vehicles). And thus not in a neat database structure.

    When tranferring the data to the new sheet, which is a better and traditional "2-D" database", I planned to create an extra column with the reference to the names from the other sheet, so that that given row knows which naming range of data to take the data from.

    So, for instance, in column B of the new "simple DB" (where the data is GOING TO) , each entry has a reference to the applicable excel defined Name (again, e.g. "Netherlands_Vehicles").

    When using the VLOOKUP function to pull the data from the original sheet to the new database, I am not able to use the name from column B directly into the VLOOKUP function simply by using the formula =VLOOKUP(A1;B1;50;false), where B1 is where I had written "Netherlands".

    So I will have to adjust all the entries according to the name manually (in this case I have more than 50 names), which is extremely time consuming.

    Is there any way I can refer to a name by writing that given name in a cell for that row?

    Thank you
    Soeren P.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Using multiple names and referring to names via cells; when tranferring btw 2 she

    Hello,

    see the attached file for an example. Sheet1 has ranges all over the place, highlighted in color.

    Sheet2 has a formula in column A that uses the text entered in column B as the range name to look up

    =INDEX(INDIRECT($B2),ROW(INDIRECT("A"&COUNTIF($B$1:$B2,$B2))))

    Since the formula is using Indirect() it is volatile. As soon as you have the data in the target sheet, you should copy it and paste it as values, so the formula is overwritten with the results.

    You see towards the end that there is a #Ref! error. This occurs when the referenced range has fewer rows than the category occurs in column B. For example, there are only 4 people in the "people" range, but the "people" text is listed 8 times. Just enter the next range name in column B on the row where the error occurs in column A and you will see the first item of the next range.

    cheers,
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-10-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Using multiple names and referring to names via cells; when tranferring btw 2 she

    Thanks Teylyn. This was great help, and it particularly helped me better understand the Indirect function, which is useful.

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Using multiple names and referring to names via cells; when tranferring btw 2 she

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1