Question : Help with excel formula

I have excel file with 2 sheets:

1 sheet includes data with codes, balances, 2nd sheet includes codes and types.

I need to summarize based on types which you can see on 2 nd sheet
I created 4 ranges.  You can see it on 2nd sheet (res is a range name)

On row level I have formula: =IF(MATCH(D2,res,0), B2).  I need sum

I need single formula which summarize balance for 4 types.  Because I want to use this formula in another excel workbook.  something like if match then include into sum

*** Please don't give me sum of row levels.  I can do it myself.  I need to put it in one formula either dsum or sumif

Answer : Help with excel formula

Hello Mikey,

I assume you want to sum data column B when column D has a code belonging to one particular type. You could try a formula like this for "Office", repeat for your other types

=SUMPRODUCT((Sheet2!B2:B46="Office")*SUMIF(data!D:D,Sheet2!A2:A46,data!B:B))

Note: you have at least one trailing space in Sheet2 B2, you need to fix those otherwise the formula won't give the correct results....or add in a TRIM function, i.e.

=SUMPRODUCT((TRIM(Sheet2!B2:B46)="Office")*SUMIF(data!D:D,Sheet2!A2:A46,data!B:B))

regards, barry

Random Solutions  
 
programming4us programming4us