Using SumIFS with an additional Lookup

Hello, I have a Sumif that works for the overall calculation but I am unable to have a lookup to see if it is a branch region or total from cell C5

If it's a branch, it should Check against Export Table L:L
If it's a region, it should check against Export Table M:M
And if it's a total it should sum up everything.


This formula works for everything but I can't seem to get it working for scenarios one and two.
=-SUMIFS(Export_Table!P:P,Export_Table!H:H,$C8,Export_Table!A:A,Template!D$5,Export_Table!B:B,Template!$F$1)

Thank you for your help.
LVL 1
mattfmillerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
Can you post your sample file as i'm not sure what you are trying to do here..

Saurabh...
mattfmillerAuthor Commented:
Actually I figured it out.  I just ended up using a if statement based on a lookup.  It's not pretty but it works.

Thanks.

=IF($C$3="Total",SUMIFS(Export_Table!$P:$P,Export_Table!$H:$H,$C134,Export_Table!$A:$A,Template!D$5,Export_Table!$B:$B,Template!$F$1,Export_Table!$E:$E,"2 - Expenses"),IF(VLOOKUP($C$3,Ref_Table!$E:$F,2,FALSE)="Region",SUMIFS(Export_Table!$P:$P,Export_Table!$H:$H,$C134,Export_Table!$A:$A,Template!D$5,Export_Table!$B:$B,Template!$F$1,Export_Table!$M:$M,Template!$C$3,Export_Table!$E:$E,"2 - Expenses"),SUMIFS(Export_Table!$P:$P,Export_Table!$H:$H,$C134,Export_Table!$A:$A,Template!D$5,Export_Table!$B:$B,Template!$F$1,Export_Table!$L:$L,Template!$C$3,Export_Table!$E:$E,"2 - Expenses")))

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mattfmillerAuthor Commented:
Figured out a solution on my own.  It's not pretty or clean but it works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.