Write a formula to get Department Budget for a Month [Homework]

Time for another homework. You got a spreadsheet of department budgets and need to write a formula to get budget for a given department, month combination.

department-budget-2d-lookup-problem

Homework Specifics:

Assume your data is in the table named budgets, D18 has department and D19 has month values.

You can use any formula in Excel to get the answer. Let’s get creative and have fun.

Post your solutions in the comments section. GO!!!

Need a sample file? Get it from here.

Need a hint? Check out my 2D lookups article.

Want more homework problems? See this page.

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

42 Responses

  1. I’d use nested XLOOKUPs, as follows:

    =XLOOKUP(D18,budgets[Department],XLOOKUP(D19,budgets[#Headers],budgets))

    1. Almost the same, just accounted for “not found” and forced exact match.
      =XLOOKUP(D19,budgets[[#Headers],[Jan]:[Jun]],XLOOKUP(D18,budgets[Department],budgets[[Jan]:[Jun]],””,0))

      Verification pointed out that Administration was misspelled so I added Data Validation to D18 and D19.

  2. =INDEX(FILTER(budgets[[Jan]:[Jun]],budgets[Department]=D18),MATCH(D19,budgets[[#Headers],[Jan]:[Jun]],0))

  3. =INDEX(budgets[[Jan]:[Jun]],MATCH(D18,budgets[Department],0),MATCH(D19,budgets[[#Headers],[Jan]:[Jun]],0))

  4. So many functions to choose from.

    My first thought was an “old school” solution using OFFSET with MATCH. In trying to learn something new I came up with…

    =FILTER(FILTER(budgets,budgets[Department]=D18),budgets[#Headers]=D19)

    1. Using cell references, rather than range names:

      =vlookup(D18,Budgets,match(D19,index(Budgets,1),0)-1,0)

      1. Whoops. Hadn’t noticed “budgets” didn’t include the header row. Third time lucky?

        =VLOOKUP(D18,budgets,MATCH(D19,OFFSET(INDEX(budgets,1,),-1,0),0),0)

  5. Using the old Index and Match function
    =INDEX(budgets[#All],XMATCH(D18,budgets[[#All],[Department]],0),XMATCH(D19,budgets[#Headers],0))

    And using the new Xlookup
    =XLOOKUP(D18,budgets[Department],XLOOKUP(D19,budgets[[#Headers],[Jan]:[Jun]],budgets[[Jan]:[Jun]]))

    Using Filter
    =FILTER(FILTER(budgets,budgets[Department]=D18),budgets[#Headers]=D19)

  6. {=INDEX(budgets[#Tout];EQUIV(D18;budgets[Department];0);EQUIV(D19;budgets[[#En-têtes];[Jan]:[Jun]];0))}

  7. {=INDEX(budgets[[Jan]:[Jun]];EQUIV(D18;budgets[Department];0);EQUIV(D19;budgets[[#En-têtes];[Jan]:[Jun]];0))}

  8. Just to be different….

    =XLOOKUP(D19,budgets[#Headers],FILTER(budgets,budgets[Department]=D18,””),”Not Found”)

    I also found that the following works:

    =INDEX(budgets,XMATCH(D18,budgets[Department]),XMATCH(D19,budgets[#Headers]))

  9. =INDEX(budgets[[Jan]:[Jun]],MATCH(D18,budgets[Department],1),MATCH(D19,budgets[[#Headers],[Jan]:[Jun]],0))

    Will get you the answer

  10. =SUMPRODUCT(budgets[[Jan]:[Jun]],MMULT((budgets[Department]=D18)*1,(budgets[[#Headers],[Jan]:[Jun]]=D19)*1))

  11. This approach should be quite pretty :

    in French
    =SOMME(RECHERCHEX(D18;C4:C11;D4:I11) RECHERCHEX(D19;D3:I3;D4:I11))

    in English, it should be :
    =SUM(XLOOKUP(D18;C4:C11;D4:I11) XLOOKUP(D19;D3:I3;D4:I11))

    with a space between the 2 XLOOKUP

  12. =SUMPRODUCT((budgets[[Jan]:[Jun]])*(budgets[[#Headers],[Jan]:[Jun]]=$D$19)*(budgets[Department]=$D$18))

  13. =+?ND?S(budgets[[Jan]:[Jun]];KAÇINCI(D18;budgets[Department];0);KAÇINCI(D19;budgets[[#Üst Bilgiler];[Jan]:[Jun]];0))

  14. Using Index and Matching Look Up row & column wise

    =INDEX(budgets[[Jan]:[Jun]],MATCH(D18,budgets[Department],0),MATCH(D19,budgets[[#Headers],[Jan]:[Jun]],0))

  15. =XLOOKUP(D18,budgets[Department],XLOOKUP(D19,budgets[[#Headers],[Jan]:[Jun]],budgets[[Jan]:[Jun]]))

  16. =INDEX(D4:I11,MATCH(D18,C4:C11,0),MATCH(D19,D3:I3,0))

    Please tell me if I am correct or wrong?

  17. =INDEX(budgets[#All],MATCH(D18,budgets[[#All],[Department]],0),MATCH(D19,budgets[#Headers],0))

    here’s mine, I hope this is a viable solution

  18. I used INDEX+MATCH+MATCH:

    =INDEX(budgets[[Jan]:[Jun]],MATCH(D18,budgets[Department],0),MATCH(D19,budgets[[#Headers],[Jan]:[Jun]],0))

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.