# Compare Data and Show Differences

#### VBA~NOOB

##### Banned
Hello,

I have four columns of data - column "a" has a name column "b" has a dollar amount column "c" has a name and column "d" has a dollar amount.

I want to compare the names in column "a" to the names in column "c" and if they match subtract column "b" from column "d" to show the difference.

I've tried everything I can think of, but can't get it to work.

Any assistance would be appreciated.

Thank you

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You could try this one (untested).

=sumproduct((\$a\$1:\$a\$50="name")*(\$b\$1:\$b\$50))-sumproduct((\$c\$1:\$c\$50="same name)*(\$d\$1:\$d\$50))

Thanks but no go

I have this but I need it to do the math

=IF(VLOOKUP(\$c3,ded,1,FALSE)="","",(VLOOKUP(\$c3,ded,1,FALSE)))

Code:
``Thanks but no go``

In my example it works, so please try again.

E1 contains the given formula and results in 3 (as expected).

A B C D E
Joep 1 Sofie 1 3
Kees 2 Merel 2
Karel 3 Petra 3
Sofie 4 bla 4
Merel 5 bla 5
Petra 6 bla 6

Code:
``Thanks but no go``

In my example it works, so please try again.

The columns with names have spaces and commas in them. Is that interfering with the formula?

The name has to be exact to the name in the range.

show some (just a few) data so we could guide you through this problem.

The name has to be exact to the name in the range.

show some (just a few) data so we could guide you through this problem.
 Name 20140819 Name 20140902 Anderson, Kristine B \$32.50 Anderson, Kristine B \$14.25 Anderson, Madeline \$25.31 Anderson, Madeline \$21.51 Anderson, Melissa L \$6.40 Anderson, Melissa L \$5.11 Anderson, Michele L \$52.61 Anderson, Michele L \$57.34 Anderson, Michelle Ann \$3.13 Anderson, Michelle Ann \$3.17 Anderson, Samantha Jo \$18.42 Anderson, Samantha Jo \$12.53 Anderson, Susan L \$88.26 Anderson, Susan L \$10.94 Anderson, Tammy J \$1.40 Anderson, Tammy J \$1.25 Anderson, Teresa K \$20.85 Anderson, Teresa K \$12.01 Johnson, Amy J \$25.32 Johnson, Amy J \$18.19 Johnson, Brandi M \$10.92 Johnson, Brandi M \$22.59 Johnson, Brittany Rae \$6.00 Johnson, Brittany Rae \$3.75 Johnson, Carmen L \$29.00 Johnson, Carmen L \$45.89 Johnson, Christina A \$27.31 Johnson, Christina A \$24.58 Johnson, Corey B \$57.77 Johnson, Corey B \$64.26 Johnson, David William \$43.46 Johnson, David William \$39.73 Johnson, Jill A \$9.80 Johnson, Jill A \$8.53 Johnson, Karen K \$6.75 Johnson, Karen K \$8.67 Johnson, Kelly Jean \$11.12 Johnson, Kelly Jean \$8.20 Johnson, Kevin S \$17.50 Johnson, Kevin S \$18.45 Johnson, Kolleen \$10.00 Johnson, Kolleen \$29.51 Johnson, Lindsay Leigh \$81.44 Johnson, Lindsay Leigh \$55.99 Johnson, Melissa M \$39.82 Johnson, Melissa M \$32.84 Johnson, Michelle Lynn \$24.32 Johnson, Michelle Lynn \$5.50

<tbody>
</tbody>

THANKS

If the names are always in the same row why not:

e2=d2-b2

I think we're all over thinking this.

I want to compare the names in column "a" to the names in column "c" and if they match subtract column "b" from column "d" to show the difference.

Compare:

A1 = C1

Subtract:

D1 - B1

If:

Code:
``If(A1=C1,D1-B1,0)``

Replies
3
Views
83
Replies
1
Views
66
Replies
6
Views
328
Replies
16
Views
230
Replies
2
Views
306

1,207,288
Messages
6,077,546
Members
446,287
Latest member
lihong3210

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

### Which adblocker are you using?

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

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