You haven't given us a lot of information about the actual data but I will assume that the [long number] is an actual number (not a string) and is an integer that needs to be aggregated
and that the number to be compared is an actual number also
sum[long number]%10000 will return the last 4 digits of the long number as a number that can be compared to your target number
sum[long number]%10000 = sum[target]
If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.
If just for matching purpose, you can create a calculation like Int(right( Str([long number]),4))
Hope this helps