+ Reply to Thread
Results 1 to 6 of 6

VLookup and If true tests

  1. #1
    Registered User
    Join Date
    04-03-2011
    Location
    uae
    MS-Off Ver
    Excel 2003
    Posts
    5

    VLookup and If true tests

    Hi,

    I get sent a very detailed multi sheet spreadsheet monthly and need to pull the information. At present I have been using Vlookup and HlookUp to automatically extract the data I need. However the sheet I am being sent is changing each time and thus think there is a smarter way of doing this than how it has been set up.

    I need to find the:
    ROW: country with the specific variable then
    COLUMN: draw from either volume or value and then draw either abc or def under the Volume/variable.

    This all from a specific sheet.. yes i know!!!

    The problem is coming in with the variables as VlookUp will draw the first occurrence of the country. Allowing me to easily draw variable x but not variable y (Note the country row is actually merged with the two variables in the next column).
    Column is not a problem as I can do a simple count from VLookUp as that data stays constant.

    I would like to find a way to tell the cell to look for the country then to check the cell next to it for a variable (note country column is rows merged not separate cells with two entries) and if not true to move down one row (still in the column next to to country (variable column)) and check if that is right (remembering that as a variable is sometimes broken down that it may need to move more that one row) while still ensuring that the country reference is kept.

    See attachment for a short summary of what I get.

    Thanks for the help!
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: VLookup and If true tests

    You can use INDEX function where is:

    INDEX(array,row_num,column_num)

    and for row_num,column_num use MATCH function:

    INDEX(array, MATCH(something), MATCH(something))

    I still didn't get where you pulling data from but this would be approach to use.

  3. #3
    Registered User
    Join Date
    04-03-2011
    Location
    uae
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: VLookup and If true tests

    Thanks,
    Is there any function that will return an array instead of a row? (Match returns the first row where the value is found, even if that value is in multi column merged cells (and therefore an array)).

    If i get the row array where the merged cell is (country a/country b) then i can use that array to find the row where the variable is located (variable x/variable y) and using that row then pull the data from the appropriate column...

    An example of the data i am trying to pull would be:
    ROW: country a, variable x,
    COLUMN: Value, Year

    Thus returning a single cell value.

  4. #4
    Registered User
    Join Date
    04-03-2011
    Location
    uae
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: VLookup and If true tests

    Thought I'd found the solution with a combine (=A1&B1) then using that in MATCH to give row for the INDEX but as the cells are merged only the top cell of the merged group is being combined and the rest are just taking blank from the first column and the value from the second.


    ARRRG!!! stupid merged cells!!!

    Anyone have any ideas how to manipulate the merged cell to give an array?

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: VLookup and If true tests

    Use a simple rule: Avoid merged cells in excel I don't have them in any of my tables

  6. #6
    Registered User
    Join Date
    04-03-2011
    Location
    uae
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: VLookup and If true tests

    Quote Originally Posted by zbor View Post
    Use a simple rule: Avoid merged cells in excel I don't have them in any of my tables
    I am being sent the sheet with their merged cells... might be easier to change theirs into what I need rather than changing mine...

    any function to unmerge cells and replicate the data from the first cell into the other now unmerged cells?

+ 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