Compare Data and Show Differences

VBA~NOOB

Banned
Joined
Jun 5, 2014
Messages
14
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 can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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))
 
Upvote 0
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)))
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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.
Name20140819Name20140902
Anderson, Kristine B$32.50Anderson, Kristine B$14.25
Anderson, Madeline$25.31Anderson, Madeline$21.51
Anderson, Melissa L$6.40Anderson, Melissa L$5.11
Anderson, Michele L$52.61Anderson, Michele L$57.34
Anderson, Michelle Ann$3.13Anderson, Michelle Ann$3.17
Anderson, Samantha Jo$18.42Anderson, Samantha Jo$12.53
Anderson, Susan L$88.26Anderson, Susan L$10.94
Anderson, Tammy J$1.40Anderson, Tammy J$1.25
Anderson, Teresa K$20.85Anderson, Teresa K$12.01
Johnson, Amy J$25.32Johnson, Amy J$18.19
Johnson, Brandi M$10.92Johnson, Brandi M$22.59
Johnson, Brittany Rae$6.00Johnson, Brittany Rae$3.75
Johnson, Carmen L$29.00Johnson, Carmen L$45.89
Johnson, Christina A$27.31Johnson, Christina A$24.58
Johnson, Corey B$57.77Johnson, Corey B$64.26
Johnson, David William$43.46Johnson, David William$39.73
Johnson, Jill A$9.80Johnson, Jill A$8.53
Johnson, Karen K$6.75Johnson, Karen K$8.67
Johnson, Kelly Jean$11.12Johnson, Kelly Jean$8.20
Johnson, Kevin S$17.50Johnson, Kevin S$18.45
Johnson, Kolleen$10.00Johnson, Kolleen$29.51
Johnson, Lindsay Leigh$81.44Johnson, Lindsay Leigh$55.99
Johnson, Melissa M$39.82Johnson, Melissa M$32.84
Johnson, Michelle Lynn$24.32Johnson, Michelle Lynn$5.50

<tbody>
</tbody>

link to document https://drive.google.com/file/d/0ByWDiNG3v64TNEF1ZHZDNnpBRWM/edit?usp=sharing

THANKS
 
Upvote 0
You need to log in to use sharing (so I don't get your excel file)

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

e2=d2-b2
 
Upvote 0
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)
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,208
Members
448,554
Latest member
Gleisner2

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