+ Reply to Thread
Results 1 to 5 of 5

Excel function to select two columns based on range

  1. #1
    Registered User
    Join Date
    03-08-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    32

    Excel function to select two columns based on range

    Hi,

    Can you help me with an function to select two columns based on the header and the variable given.

    Sample excel file attached for your ref.

    Excel sample.JPG

    Also Kindly find the excel file in which I am looking for an formula which will look up variable in Col A for Eg USD and search the same in Row 1 and then will select COL D:E and so forth for other currency.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Excel function to select two columns based on range

    It's not clear what you actually want to do with the range - but here's an example of using offset and match to determine the range you want, then using it in a vlookup:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    03-08-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Excel function to select two columns based on range

    Hi,

    I am looking for an function which can help me to select range of two col based on variable in Col A.

    For Eg, B2 should have a formula which is selecting range D3:E8 by searching the variable name in Row 1

    same way B3 should be F3:G8

    The formula should not pull any date value in Col B, it should select the range.

    Thanks

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Excel function to select two columns based on range

    A formula can't select a range. It can use it, to do something else with, but can't select it. Your existing formula does nothing:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    The range part of my formula above is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you just want to display the range address, you'll need a small UDF, something like:
    Please Login or Register  to view this content.
    So then, combine the two, and your formula in B2 becomes:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Expert cbatrody's Avatar
    Join Date
    04-15-2014
    Location
    Dubai
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    2,136

    Re: Excel function to select two columns based on range

    Alternatively, you can use the following formula in B2:

    =ADDRESS(3,MATCH($A2,$A$1:$K$1,0))&":"&ADDRESS(8,MATCH($A2,$A$1:$K$1,0)+1)
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need IF statement (inside of Linest Function) that will select range based on dates
    By cpkrehbiel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-07-2014, 09:22 PM
  2. [SOLVED] Excel VBA Perform function based on range
    By punter in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-26-2013, 09:22 AM
  3. Select certain columns based on date
    By segeorge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-10-2007, 12:03 PM
  4. [SOLVED] Modfiy row of VB to select range of columns
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2006, 05:55 PM
  5. Select cell from range based on input in excel xp
    By dingy101 in forum Excel General
    Replies: 3
    Last Post: 11-19-2005, 08:10 PM

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