+ Reply to Thread
Results 1 to 5 of 5

Lookup and return Heading of column based on criteria (sample data attached)

  1. #1
    Registered User
    Join Date
    09-13-2017
    Location
    England
    MS-Off Ver
    2010
    Posts
    16

    Lookup and return Heading of column based on criteria (sample data attached)

    Hi,

    Basically I have columns for each month Jan - Dec (and a total) which hold monitary, or null values.
    Next to the total there's two coloumns Forecast Begin and First Month's spend

    The formula I need help with is Forecast Begin but the First Month's Spend formula may help some of you with it

    First Month's Spend:
    Please Login or Register  to view this content.
    Somebody wrote this code for me, I've tried to backwards engineer it to help with the Forecast Begin formula but I'm clearly not clever enough

    Basically what I need to know, is what month the first forecasted spend is (that is not in any months that have passed).
    LINE 13: There are two monitary values over the course of 12 months, first there is £6,000 in March, and next there is £12,266 in July.
    Since March has been and gone, I'm only interested in the first monitary value in the future, in this case it is £12,266.
    My First Month's Spend formula is correcetly bringing back £12,266 but now I need the Forecast Begin column to display July as that is the month that it is being spent.

    I believe there are two routes to achieving this:
    1) Find the firist value, much like the First Month's Spend formula does, and then find the month that the value is in
    2) Use the First Month's Spend column, as this has already found the value, and then find the month based on that.

    My only concern with option 2) is that there may be spends that are identical and therefore, if a LOOKUP or something similar was used, it may cause false results.

    There is a sample workbook, with fake, irrelivent data for you guys to use - hope it helps.
    Any additional info required please let me know

    Many thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: Lookup and return Heading of column based on criteria (sample data attached)

    Try

    in O2

    =IFERROR(SMALL(IF(($A$1:$L$1>=EOMONTH(TODAY(),-1)+1)*($A2:$L2>0),$A$1:$L$1,""""),1),"No spend")

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Then copy down

  3. #3
    Registered User
    Join Date
    09-13-2017
    Location
    England
    MS-Off Ver
    2010
    Posts
    16

    Re: Lookup and return Heading of column based on criteria (sample data attached)

    Quote Originally Posted by JohnTopley View Post
    Try

    in O2

    =IFERROR(SMALL(IF(($A$1:$L$1>=EOMONTH(TODAY(),-1)+1)*($A2:$L2>0),$A$1:$L$1,""""),1),"No spend")

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Then copy down
    Thank you. It worked to some extent, it had random numbers so I changed the cell formatting to 'Date' and it gives me the short date e.g. 01/05/2018 but they're all the 1st of the month. Is there any way to get in text "May". I altered the cell formatting again to a custom one, just the month, so it now just says 05 for May. I know a way to get the results I want by hiding your formula and then using another formula in the cell i want displayed - but is there a way to integrate it with your solution so I don't have hidden formulae everywhere?

    I've rep'd you

  4. #4
    Registered User
    Join Date
    09-13-2017
    Location
    England
    MS-Off Ver
    2010
    Posts
    16

    Re: Lookup and return Heading of column based on criteria (sample data attached)

    Quote Originally Posted by kai. View Post
    Thank you. It worked to some extent, it had random numbers so I changed the cell formatting to 'Date' and it gives me the short date e.g. 01/05/2018 but they're all the 1st of the month. Is there any way to get in text "May". I altered the cell formatting again to a custom one, just the month, so it now just says 05 for May. I know a way to get the results I want by hiding your formula and then using another formula in the cell i want displayed - but is there a way to integrate it with your solution so I don't have hidden formulae everywhere?

    I've rep'd you
    Nevermind! I actually figured it out on my own! I wrapped the formula in TEXT and used the formatting of "MMM" and now it works

    I'll mark the thread as SOLVED now. Thanks again!

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: Lookup and return Heading of column based on criteria (sample data attached)

    Format as "mmm-yy"

+ 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: 1
    Last Post: 04-30-2018, 12:23 PM
  2. [SOLVED] Find value based on what the current month is (sample data is attached)
    By kai. in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-30-2018, 08:32 AM
  3. [SOLVED] Lookup part number in column and return heading if found
    By Gorbs in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-14-2015, 03:34 PM
  4. Lookup Value with merged cells (Sample Attached)
    By psingh2688 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2015, 08:58 PM
  5. [SOLVED] Whick lookup needed to return a column heading?
    By Thistledown in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-11-2014, 08:08 AM
  6. lookup values in a range,return corresponding column heading
    By aljaffa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2011, 04:31 PM
  7. Combining If and Lookup for Complicated Data (Sample is attached)
    By than_k22 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-15-2010, 01:13 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