Sum if offset cell equals particular value

jbenfleming

New Member
Joined
Mar 30, 2017
Messages
34
So lets say i have two columns. One with names (John and Jane) and one with values. What is a formula I could input in B5 and B6 (John and Jane respectively) that would show the sum for each person. For instance the formula in B5 would return 2 and B6 would return -2. The list I'm using will have rows added regularly. I know that I could use VBA but I would rather not.

[TABLE="width: 200"]
<tbody>[TR]
[TD]JOHN[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD]-1[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD]-1[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]TOTAL JOHN
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TOTAL JANE[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
ok, try this


Excel 2013/2016
AB
1JOHN1
2JANE-1
3JANE-1
4JOHN1
5JANE1
6JOHN1
7JANE5
8JOHN3
9JANE2
10JOHN5
11JANE3
12JOHN3
13JOHN2
14JANE1
15JOHN3
16TOTAL
17JOHN16
18JANE10
Sheet3
Cell Formulas
RangeFormula
B17=SUMIF(INDIRECT("$A$1:$A$"&MATCH("TOTAL",A:A,0)-2),A17,INDIRECT("$B$1:$B$"&MATCH("TOTAL",A:A,0)-2))
 
Upvote 0
One question, shouldn't the match functions have "-1" at the end rather than "-2"? Otherwise you are omitting the last row of data (John 3, in this case)
 
Upvote 0
Lol, yup. That is much better. Thank you. I'm used to doing everything with VBA so I have an admittedly poor skill set with in sheet formulas. Getting better though.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top