fbpx

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

Excel Challenges - 31 comments

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.

Chandoo

Hello Awesome...

My name is Chandoo. Thanks for dropping by. My mission is to make you awesome in Excel & your work. I live in Wellington, New Zealand. When I am not F9ing my formulas, I cycle, cook or play lego with my kids. Know more about me.

I hope you enjoyed this article. Visit Excel for Beginner or Advanced Excel pages to learn more or join my online video class to master Excel.

Thank you and see you around.

Related articles:

Written by Chandoo
Tags: , , , , , ,
Home: Chandoo.org Main Page
? Doubt: Ask an Excel Question

31 Responses to “Write a formula to get Department Budget for a Month [Homework]”

  1. TheQ47 says:

    I'd use nested XLOOKUPs, as follows:

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

  2. Finnur says:

    Old school:

    =HLOOKUP(D19;budgets[#All];MATCH(D18;budgets[[#All];[Department]];0);0)

  3. Prashant says:

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

  4. Prashant says:

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

  5. Daniel says:

    =INDEX(FILTER(budgets,INDEX(budgets,,1)=D18),XMATCH(D19,budgets[#Headers],FALSE))

  6. Tan Yann Lin says:

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

  7. Jomili says:

    Way old school:
    =VLOOKUP(D18,budgets[#All],MATCH(D19,budgets[#Headers],0),FALSE)

  8. Frank McCraw says:

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

  9. Craig says:

    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)

  10. Denys Calvin says:

    =vlookup(Dept,Budgets,match(Month,index(Budgets,1),0)-1,0)

    • Denys Calvin says:

      Using cell references, rather than range names:

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

      • Denys Calvin says:

        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)

  11. mohammed mustafa says:

    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)

  12. fethi ben yahia says:

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

  13. fethi ben yahia says:

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

  14. John Johnston says:

    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]))

  15. Michael says:

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

    Will get you the answer

  16. SAM MO says:

    Name Monthly Ranges first

    =XLOOKUP(D18,budgets[Department],INDIRECT(D19))

  17. Eric Surdez says:

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

  18. =VLOOKUP(D18,budgets[#All],MATCH(D19,budgets[#Headers],0),FALSE)

  19. Zaig says:

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

  20. Borg says:

    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

  21. ari says:

    well sumproduct is powerfull
    =SUMPRODUCT((C4:C11=D18)*(D3:I3=D19)*D4:I11)

  22. Sanditon needs a Season2 says:

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

  23. Adem Kür?at Karaçil says:

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

  24. Nadeem says:

    =HLOOKUP(D19,budgets[#All],MATCH(D18,budgets[[#All],[Department]],1),)

  25. venky says:

    =INDIRECT(ADDRESS(MATCH(D18,$A$1:$A$9,0),MATCH(D19,$A$1:$F$1,0)))

    Assuming table starts in A1

  26. R1DZ says:

    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))

  27. Guido says:

    1. define rangenames for the rows and columns
    2. then use the fomule =Marketing Apr

  28. Parshwa says:

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

Leave a Reply


« »