I have a sheet with a column of dates, some may repeat, and amounts in the column next to those dates. On another sheet I also have a sheet full of dates some that may repeat and other amounts. I need a formula that will go through the first sheet's dates and find the nearest amount to that date thats on the second sheet and bring me back the difference between the two. The amount on Sheet 1 will always be greater than or equaled to what is on sheet 2 for the proper match up. An example of my problem is detailed below.
Sheet 1 will have
09/08/2014 $3,838
09/08/2014 $564
09/08/2014 $1023
09/09/2014 $645
Sheet 2 will have
09/08/2014 $561
09/08/2014 $1023
09/09/2014 $35
Basically what the end result should be is for the formula to give the difference between what is on sheet 1 and what is on sheet 2. the formula that compares sheet 1 and sheet 2 cannot be based on a parameter for example a this is 90% of this so these are to be matched. this is because there will be situations where they should be matched up even though whats on sheet 2 is only 10% of whats on sheet 1 but its the only instance of that number on sheet 1 so they must be matched up. So the final results should look like this below
09/08/2014 $3,838 = $3,838
09/08/2014 $564 = $3
09/08/2014 $1023 = 0
09/09/2014 $645 = $610
I believe what I am looking for is going to involve indexing the formula among other things. I have tried doing this formula a ton of ways already including an extensive nested if and vlookup and also adding some sumifs in a separate column and concatenating dates and amounts but that route didnt lead me any success either. Feel free to add stuff to other columns to go off of. The first rule in the formula I think would be to match the exact numbers then match the next closest numbers and subtract them then any left over unmatched would be just the number of sheet 1 but numbers on sheet 2 can only be used once