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

LVL 1
###### Who is Participating?

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.

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

Saurabh...
Author 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