# sum by searching up based on a different column

1. ## sum by searching up based on a different column

I want sum based on key t in total column. The logic is as shown in the figure

The Total column should sum the data by searching up the t in key column

How do we achieve this in the Total field?  Register To Reply

2. ## Re: sum by searching up based on a different column

In D3 =IF(B3="t",SUM(\$C\$3:C3),"")
In D4 =IF(B4="t",SUM(\$C\$3:C4)-SUM(\$D\$3:D3),"") and pull down as needed  Register To Reply

3. ## Re: sum by searching up based on a different column

As I preferred a structured formula for the table, I modified the key flag to a number instead of t and used the formula in Cell D3
IF(B4<>"", SUM(C3:INDEX(C:C, MATCH(1E+99, B\$1:B3))), "")

However, I am not getting the total when there are multiple cells to be added. Total should appear corresponding to the cell where 1 is present in the key. Please help tweak the code?  Register To Reply

4. ## Re: sum by searching up based on a different column

Whats is wrong with the provided answer?  Register To Reply

5. ## Re: sum by searching up based on a different column

i desire the total to be against the same row as the "key"  Register To Reply

6. ## Re: sum by searching up based on a different column

Try in D3: ``Please Login or Register  to view this content.``  Register To Reply

There are currently 1 users browsing this thread. (0 members and 1 guests) 