I'm having problems trying to lookup a long (18 digit) reference number. I'm working with credit card charges, where each charge has a unique 18-digit reference number. Data is processed each week. I am saving the reference numbers that have already been processed in a list (formatted as text). When we process new data, the input file contains all charges in the current billing cycle (which may include some that were already processed in the previous week), so we need to check each reference number to verify that it has not already been processed (i.e. is not in the list of processed numbers).
I tried using:
where Reference is a STRING variable that is set to the reference number, but if the first 15 digits match, Excel will deem the values equal. For example, if 123456789012345000 is in the processed list, and a new charge with reference of 123456789012345123 is checked, the COUNTIF will return a 1, even though the looked-up value does not actually exist. Apparently Excel is "helpfully" converting the text values to numerical values before comparing them (and then looking only at the significant digits).Please Login or Register to view this content.
I tried using MATCH instead of COUNTIF, but of course this returns an error if the reference value is not found. I tried using IFERROR with the MATCH worksheet function but that still just trips a runtime error!
Is there any way to do this lookup (to simply check whether an 18-digit reference number exists in the processed list) without resorting to an error handler with the MATCH worksheet function? I feel like I'm missing some stupid-simple solution, but so far I haven't been able to come up with anything that works.
Bookmarks