+ Reply to Thread
Results 1 to 7 of 7

Returning value from one column based on two neighboring columns

  1. #1
    Registered User
    Join Date
    02-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    46

    Returning value from one column based on two neighboring columns

    I am attempting to compare a list of dates to a table of date data and am trying to return the value of one of the columns if the date falls between two dates listed in the other columns.

    To clarify, I have a column with a list of start dates and a column with a list of end dates (these ranges do not overlap). Next to those two columns I have a third column with a list of data that I wish to return if a given date is between the two dates in the other columns. For example, if a row in column one has 2/1/2014 in it and a row in column two has 2/28/2014 in it, I want to return the data in the third column from that row if I enter in the date 2/26/2014 in it elsewhere.

    I have tried creating an array formula to pull the data, but I am not too familiar with them yet and the formula is not working. The formula I have been trying is below:

    Please Login or Register  to view this content.
    Where A1 is the cell with a given date, WeekStart is a named range with all of the start dates, WeekEnd is a named range with all of the end dates, and Weeks is a named range containing the data in all three columns.

    I think that I may need to use ROW() in some fashion, but I am not quite sure how.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Returning value from one column based on two neighboring columns

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning value from one column based on two neighboring columns

    Here's one possibility if your date intervals are in ascending order.

    Data Range
    A
    B
    C
    D
    E
    F
    1
    Start
    End
    Data
    -----
    Date
    Data
    2
    1/1/2014
    3/27/2014
    Data 1
    5/12/2014
    Data 3
    3
    3/28/2014
    4/21/2014
    Data 2
    4
    4/22/2014
    6/1/2014
    Data 3
    5
    6/2/2014
    9/15/2014
    Data 4


    This formula entered in F2:

    =LOOKUP(E2,A2:C5)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    02-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    46

    Re: Returning value from one column based on two neighboring columns

    I attached an example of what I am working with.

    I have tried two different ranges with my formula as you can see. One with all three columns and one with just the first column that has the data.

    I also tried the LOOKUP function but that doesn't seem to be working as intended either.
    Attached Files Attached Files

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning value from one column based on two neighboring columns

    Try this...

    =LOOKUP($G$2,B2:B16,A2:A16)

    Note that the sample file is set to manual calculation. You might want to make sure it's set to automatic calculation.

  6. #6
    Registered User
    Join Date
    02-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    46

    Re: Returning value from one column based on two neighboring columns

    This works well. Thanks for the help.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning value from one column based on two neighboring columns

    You're welcome. Thanks for the feedback!

+ 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. Merge neighboring cells in the same column
    By xxxjeff in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2014, 02:09 PM
  2. AutoPopulate Neighboring Column
    By reneesunny in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 11-08-2013, 08:43 AM
  3. Fill in rows depending on neighboring columns
    By holp in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-20-2013, 03:52 PM
  4. [SOLVED] Returning value from a third column; based on two other columns.
    By tony8980 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-25-2012, 12:32 AM
  5. MAX/MIN/Median of column depending on neighboring values
    By Rydell in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-06-2010, 02:12 AM

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