+ Reply to Thread
Results 1 to 8 of 8

Returning a cell value in a spreadsheet not set up like a normal table

  1. #1
    Registered User
    Join Date
    06-02-2015
    Location
    Oklahoma
    MS-Off Ver
    2010
    Posts
    8

    Returning a cell value in a spreadsheet not set up like a normal table

    Hello,

    Below is a made up spreadsheet to illustrate my problem. The initial design was not made by me and unfortunately cannot be changed. I am wanting to use functions or vba to return cell values if possible.

    Here's how it works:
    Each day an employee has a note located under the date and a letter code located to the right of the note. The letter code columns do not have headers.
    In a separate sheet, I want to be able to enter the date and employee and have it return the corresponding note and letter code.
    For example, if I enter: 6/14/2015 and Employee #1, I want the result to be "note1" and "r". Or if I enter 6/22/2015 & Employee #4 ---> "note3" and "m"

    I thought the solution would be as simple as using HLOOKUP and MATCH for the note and some kind of OFFSET for the letter code, but it doesn't seem that simple.
    The problem is there is no single row going across with all the different dates, and the employees down column A repeat every week.

    I have tried various combinations of HLOOKUP, VLOOKUP, INDEX, MATCH, ADDRESS, INDIRECT, OFFSET, etc. but am completely stumped!

    Anyone have any advice?

    Thanks!
    ...........A.................B...........C........D..........E...........F...........G.............H..........I..........J..........K........L..........M............N
    1........................Sunday............Monday..............Tuesday...............Wednesday..........Thursday..........Friday................Saturday
    2........................6/14/2015........6/15/2015...........6/16/2015............6/17/2015............6/18/2015........6/19/2015...........6/20/2015
    3... Employee #1...note1.........r
    4... Employee #2...note2.........p
    5... Employee #3
    6... Employee #4
    7... Employee #5
    8... Employee #6
    9... Notes
    10........................Sunday.............Monday..............Tuesday...............Wednesday.........Thursday...........Friday................Saturday
    11........................6/21/2015.........6/22/2015...........6/23/2015............6/24/2015...........6/25/2015.........6/26/2015...........6/27/2015
    12...Employee #1
    13...Employee #2
    14...Employee #3
    15...Employee #4...........................note3........m
    16...Employee #5
    17...Employee #6
    18...Notes

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Returning a cell value in a spreadsheet not set up like a normal table

    If you want to post a two-sheet workbook, one with that data displayed and the second displaying a manualach mockup of the results you're trying to achieve, I'll give it the old college try.

    I'm thinking OFFSET with the function to define the search range, then wrap an INDEX(MATCH/MATCH) around that.


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

    View Pic
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-02-2015
    Location
    Oklahoma
    MS-Off Ver
    2010
    Posts
    8

    Re: Returning a cell value in a spreadsheet not set up like a normal table

    Great, thanks!

    Here's an example spreadsheet. I just randomly generated numbers for the note and have some random letters for the letter code.
    I hope it attached right.

    Calendar returning cell values.xls

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Returning a cell value in a spreadsheet not set up like a normal table

    You do know ALL these problems go away if you simply put the dates on one row and employee names in one set. The calendar can simply extend forever to the right. You can hide columns on the left for weeks you no longer really need to "look" at, and the formula on the SEARCH sheet would continue to work flawlessly even on the hidden data.
    Attached Files Attached Files
    Last edited by JBeaucaire; 06-18-2015 at 07:25 PM.

  5. #5
    Registered User
    Join Date
    06-02-2015
    Location
    Oklahoma
    MS-Off Ver
    2010
    Posts
    8

    Re: Returning a cell value in a spreadsheet not set up like a normal table

    Yes I know

    Unfortunately, I didn't create the spreadsheet and I don't add new information to it either. The actual spreadsheet is in that same format and contains information about products extending back 3 years. The reason it is in that format is because other users often print out the calendar to get a quick glance at 4 or 5 weeks of past and future product notes.

    I was just hoping to quickly pull information from it using lookup functions. Eventually the end goal was to be able to type a date range and "employee" and get a result of all the notes.

    If there isn't a way to do it in the current format, I'll just have to copy all the data and reformat it to where I can use lookup functions, or just use Ctrl+F and/or scroll through to gather the information I need.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Returning a cell value in a spreadsheet not set up like a normal table

    Don't go nuts extending the range of these formulas, but this will do it:

    C2:
    =INDIRECT("Calendar!" & ADDRESS((SUMPRODUCT((Calendar!$A$1:$N$1000=$A2)*ROW(Calendar!$A$1:$A$1000)))+MATCH($B2, Calendar!$A$3:$A$9, 0), (SUMPRODUCT((Calendar!$A$1:$N$1000=$A2)*COLUMN(Calendar!$A$1:$N$1)))))

    D2:
    =INDIRECT("Calendar!" & ADDRESS((SUMPRODUCT((Calendar!$A$1:$N$1000=$A2)*ROW(Calendar!$A$1:$A$1000)))+MATCH($B2, Calendar!$A$3:$A$9, 0), (SUMPRODUCT((Calendar!$A$1:$N$1000=$A2)*COLUMN(Calendar!$A$1:$N$1)))+1))

  7. #7
    Registered User
    Join Date
    06-02-2015
    Location
    Oklahoma
    MS-Off Ver
    2010
    Posts
    8

    Re: Returning a cell value in a spreadsheet not set up like a normal table

    This works perfectly! I never would have come up with this.

    I've spent about 30 mins just trying to understand how it works
    It took me a while to realize the magic is that SUMPRODUCT turns the range into a true/false or 0,1 array multiplied by each row.

    Anyway, this is awesome, thanks so much!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Returning a cell value in a spreadsheet not set up like a normal table

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 0
    Last Post: 10-30-2012, 11:53 AM
  2. Replies: 1
    Last Post: 10-26-2012, 01:21 PM
  3. [SOLVED] Trouble returning to Normal view after inserting a header and foot
    By Eazy-E in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-26-2006, 07:05 PM
  4. Convert Pivot Table to Normal Data table
    By ashish128 in forum Excel General
    Replies: 2
    Last Post: 05-02-2006, 04:40 AM

Tags for this Thread

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