+ Reply to Thread
Results 1 to 9 of 9

indirect function looking for worksheet named after current year

  1. #1
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Question indirect function looking for worksheet named after current year

    Consolidating some sheets in my workbook and trying to edit this working formula by using the INDIRECT function. How can i replace SHEET1 with the sheet name = to the current year in this VLOOKUP formula?

    =VLOOKUP($B7,'SHEET1'!$N$6:$AD$17,1+MATCH(MONTH($E7),COLUMN('SHEET1'!$N$6:$AD$6),0),0)

    I've got a number of other formula's that work using that INDIRECT function, but I can't seem to make it work with the VLOOKUP function above.

    Example: =SUM(INDIRECT(YEAR(TODAY())&"!TableName"))

    The VLOOKUP function above (It is in cell D7) searches Column N on SHEET1 for value = to B7, then looks for the column header = to the month in E7. The value in D7 does not change until the specific mmm/dd I have in E7.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: indirect function looking for worksheet named after current year

    59 views and no reaction.

    It is an indication the question is not clear to the forummembers.

    It would help if you add an excel workbook to the question.

    HOW TO ATTACH YOUR SAMPLE WORKBOOK:

    Fast answers need clear examples. Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Re: indirect function looking for worksheet named after current year

    Attaching sample...
    Attached Files Attached Files
    Last edited by BigPapaMurf; 06-28-2020 at 11:49 AM. Reason: attachment issue

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: indirect function looking for worksheet named after current year

    Maybe try

    =VLOOKUP($B6,INDIRECT(YEAR(TODAY())&"!$N$6:$AD$17"),5+MONTH($E6),0)

  5. #5
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Re: indirect function looking for worksheet named after current year

    Thanks for the help. So far so good, but needing to test out all the conditions....

    If the due date is today it works
    If the due date is next month it works
    If the due date is tomorrow (same month as today), still testing

    From another post I made a while back on here, it needs to follow at least these 2 rules...

    Basically, my first spreadsheet would display the same amount in column2 for the entire month and would not change until the first of the month. I then made adjustments so that column3 (due dates) would automatically adjust to the next due date when the date passed and then column 2 cells would adjust accordingly.

    If $E6 > today and $E6 =month(today), then display the cell value found via lookup on Personal Budget sheet month(today)
    If $E6 > today and $E6 is next month, then display the cell value found via lookup on Personal Budget sheet next month

    Doesn't really matter if $E6 < today. Past dates will never be displayed. That's why I left it out.

    This formula passed all the tests mentioned above when pointing to the old sheet1

    VLOOKUP($B6,sheet1!$A$4:$M$6,1+MATCH(MONTH($E6),COLUMN(sheet1!$A$4:$M$4),0),0)

    So I'm wondering if your suggestion will do the same. We will see when a due date of 6/29 hits tonight.

  6. #6
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Re: indirect function looking for worksheet named after current year

    Tested. It didn't seem to work

    So basically I need that INDIRECT(YEAR(TODAY()) applied to this formula...

    =VLOOKUP($B6,sheet1!$N$6:$AD$18,1+MATCH(MONTH($E6),COLUMN(sheet1!$N$6:$AD$18),0),0)

    I've attached the new sample workbook with new $ amounts to illustrate the issue

    Currently, the result is #NA when trying to apply what I would think would be the edit...

    =VLOOKUP($B6,INDIRECT(YEAR(TODAY())&"!$N$6:$AD$18"),1+MATCH(MONTH($E6),COLUMN(INDIRECT(YEAR(TODAY())&"!$N$6:$AD$6")),0),0)
    Attached Files Attached Files
    Last edited by BigPapaMurf; 06-30-2020 at 01:54 PM. Reason: correcgted column/row info to reflect sample

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: indirect function looking for worksheet named after current year

    Maybe try at D9

    =VLOOKUP($B9,INDIRECT(YEAR(TODAY())&"!$N$6:$AD$17"),5+MONTH($E9)+(E9<TODAY()),0)

  8. #8
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Re: indirect function looking for worksheet named after current year

    Testing it out. Will let you know. Thanks.

  9. #9
    Registered User
    Join Date
    04-29-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    34

    Re: indirect function looking for worksheet named after current year

    I think it is working. 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. Current year function
    By Sam at JWP in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-01-2020, 12:27 AM
  2. Replies: 4
    Last Post: 10-07-2018, 04:35 PM
  3. [SOLVED] Copy rows from worksheet to another worksheet that date is not current year
    By Lottoman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2016, 03:38 PM
  4. Copy current month named worksheet and paste into a static worksheet
    By Jissenka in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2015, 11:28 PM
  5. [SOLVED] Set PivotTable Filter to Current Day, Current Week, Current Month, or Current Year
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2014, 08:31 AM
  6. [SOLVED] Count current year in worksheet
    By Alfexcel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-26-2014, 08:58 PM
  7. [SOLVED] Current year function
    By Sam at JWP in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

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