+ Reply to Thread
Results 1 to 16 of 16

Read today's date and pull relevant data

  1. #1
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Read today's date and pull relevant data

    Hey guys, bit of a tough one here...

    I need my spreadsheet to now what day of the week it is (not date) then grab the correct information. To make myself clearer I shall explain a little more...

    I have a 'Capacity Workbook' that shows people's hours of work per day. These are fed into a main 'Data Workbook' via formulae etc.

    The main thing I need is for Excel to think 'Its Monday today! I'm going to give you Monday's data' and then read the relevant destination files. Then if it's tuesday, do the same thing.

    Will this be possible? I realise that it's a bit vague at this stage but can't really think of how to describe it any further!

    Regards

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Read today's date and pull relevant data

    A small sample workbook always help with the description, but one thing that comes to mind is using the Text function to show the day.

    =Text(A1,"ddd")

    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
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    Thankyou, attached is a file that is a much simpler version of what I currently have.

    In this workbook I've just copied the number that's on the other sheet. In reality instead of simply putting =A2, my actual formula would be =SUM(('My File Path[Capacity 2013 (2).xls]17 June - 28 June'!$AB$83)*60/27.84)*80%

    If it isn't possible to do it automatically depending on the day of the week then I may simply have to refer to my macros but the problem is that my workbook has, for some reason, gone from 1mb to 56mb (no idea why, I've tried deleting all macros to see if they were the cause but they weren't, its rather frustrating).

    Book1.xlsx

    Thanks for your time guys, much appreciated!

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Read today's date and pull relevant data

    In B3 put

    =TEXT(NOW(),"dddd")

    In B4 copied down

    =IFERROR(HLOOKUP($B$3,Sheet2!$A$1:$I$6,ROW(A2),0),"")

    Now when the day in B3 matches one of the output from Sheet2 you will get the results.

    Since today is Sunday, change A2 on Sheet2 to Sunday to test

    As far as your file increasing in size, it sounds like Excel is holding on to some ghost information. I have ran across this before. Maybe worth a try but all depends on how much is in your workbook. If you do you this "PLEASE" make a copy before trying.
    Last edited by jeffreybrown; 06-23-2013 at 03:26 PM.

  5. #5
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    Many thanks, I shall adapt my spreadsheet for this to work. Much appreciated. Do you have any idea as to why a spreadsheet would go from 1mb to 56mb? I tried saving as 2003-2007 workbook instead of a macro enabled book but then some of my macros don't work.

  6. #6
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    My apologies for the last post, I didn't read the last bit of your reply. Thankyou very much.

  7. #7
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    Jeffrey, my apologies for my simple nature this evening, I can't seem to get it to work on my actual sheet...

    =IFERROR(HLOOKUP($J$9,Capacity!$A$29:$E$30,ROW(D9),0),"")

    The code for 'today' is in J9, the table is in a sheet called Capacity and ranges from A29 to E30 in the format of the days on top with the numbers on the bottom similar to the workbook I uploaded earlier. However I don't really get what the 'ROW(D9)' bit means. Where should I focus this? At the moment it's not returning any data.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Read today's date and pull relevant data

    The ROW() function is passing the row_index_num into the HLOOKUP Function (third argument).

    =HLOOKUP(lookup_value,table_array,row_index_num,range_lookup)

    With using the ROW() function we can drag the formula down and the third argument will adjust automatically.

    Give this a try.

    In the formula as you have it now, highlight ROW(D9) and hit F9.

    It should show {9}, but you need it to be {2} with the first formula, so instead of ROW(D9), make it ROW(A2).

    =IFERROR(HLOOKUP($J$9,Capacity!$A$29:$E$30,ROW(A2),0),"") and drag down...

  9. #9
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    Perfect! Makes sense, thankyou very much. There is an area of this workbook where I require multiple arguments of this nature.

    We have established the method for the day which I can't thank you enough for. However this one requires one cell to be 'Week One' and if the other cell says 'Monday' then call week ones Monday data.

    I tried inserting another HLOOKUP function into the formula but it wouldn't work. Any ideas?

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Read today's date and pull relevant data

    Often times it would be great to see your sheet setup as the approach can be tailored to your needs.

    With that being said, he is a direction, albeit, maybe not as your data suggests.

    If it doesn't fit or you can't figure out how to adjust for your requirements, please let me know.

    Select the variable in B2 and B3 as they will both be used to pull the pertinent data from the capacity tab.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    Hi Jeff

    That's perfect, it's exactly what I need. Thankyou! I've tried changing the formula but I can't seem to get it to function. I've been fine up until this HLOOKUP function was needed and now I can't do it without your guidance haha. It feels like being a complete novice again.

    I've adapted it to =HLOOKUP($L$16,OFFSET(Capacity!$A$23,MATCH($L$14,Capacity!A23:K25,0),0,2,11),ROW(A2),0) by analysing where your formula was pointing to and myself pointing to the relevant data. However due to simplicity I've had to alter the layout of my current workbook and it's not quite in the same format.

    I would happily show you the file but as I mentioned earlier in the thread it's 56mb and that ghost data thing you mentioned hasn't seemed to work yet.

  12. #12
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Read today's date and pull relevant data

    First thing I see, you have this part MATCH($L$14,Capacity!A23:K25,0) different fron what I posted. (MATCH($B$2,Capacity!$A:$A,0))

    Second, on the offset, =OFFSET(reference,rows,cols,height,width) you are saying the table has a height of 2 and a width of 11?

    I understand your file is 56mb, but maybe you could put together a small sample file with the layout so we can get it working in its simpliest format...

  13. #13
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    I've replicated the layout of the Capacity sheet on this workbook. I changed the '$A:$A' to A23:K25 as this is where was located. My apologies for ruining your code, it worked beautifully until I got my hands on it!

    Book2.xlsx

  14. #14
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Read today's date and pull relevant data

    I'm stepping out the door right now and there might be a better way, but try this...

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    06-21-2013
    Location
    Cheltenham, England
    MS-Off Ver
    Excel 2013
    Posts
    45

    Re: Read today's date and pull relevant data

    You are my new hero! I physically can't thank you enough. It also won't let me add any more reputation. Thankyou, you've just saved me using a total of 22 Macros!

  16. #16
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Read today's date and pull relevant data

    You are very welcome and thanks for the feedback.

    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)

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