Ok
Just to be certain.
Column A is a list of dates.
Because that’s the only place the formula is searching.
It samples column T and searches for a match in column A only.
Columns A and T are account numbers. Column U is the date I want to use. Column R is where I want the date from column U (if the account numbers match) to go to.
If a number in column T matches a number in column A, copy the date from column U into column R. As can be seen from the results in post #17, I do get the dates now – but they do not correlate with the account numbers.
This might be easier to understand if you uploaded the workbook.
I couldn’t do that.
Apart from what everyone else has said, you should try and use UNC paths (\server\share) instead of letters for network drives.
Well, it’s a little clearer now.
You aren’t looking up dates, you are looking up account numbers.
The results of the lookup are dates.
Also our terms of reference differ which might be a factor in the explanation.
Try this formula in R2 and copy it down the column.
Let me know if it appears to do what you are requesting
=VLOOKUP(A2,$T$2:$U$2500,2,FALSE)
I switched the search and changed the sample table to reflect only the needed fields so don’t worry that the numbers and letters are different. If it works I’ll explin why later.
The formula we used before sampled T and searched A.
This formula samples A and searches T.
That did it!
I just got up and haven’t had coffee yet, but I logged onto RDC and it looks like it worked.
FWIW, here’s how I got what I needed without VLOOKUP:
*Start dates
FILE FILEA V(1000) SEQUENTIAL +
SYSNAME 'H:\EZ_Text_Files\802489_Start_Sort.txt'
CUR-REC 6 350 A
CUR-AR 6 12 A
CUR-START 18 10 A
*Input
FILE FILEB V(1000) SEQUENTIAL +
SYSNAME 'H:\EZ_Text_Files\802489_Input_Sort.txt'
PREV-REC 6 350 A
PREV-AR 6 12 A
PREV-START 317 10 A
FILE FILEC V SEQUENTIAL CREATE RESET +
SYSNAME 'H:\EZ_Text_Files\802489_Input_Fixed.txt'
OUT-REC 6 350 A
OUT-AR 6 12 A
OUT-START 317 10 A
*********************************************************************
JOB INPUT(FILEA KEY CUR-AR FILEB KEY PREV-AR) FINISH(Z-REC)
*********************************************************************
OUT-REC = PREV-REC
IF MATCHED
OUT-START = CUR-START
ELSE
OUT-START = ''
END-IF
PUT FILEC
Z-REC. PROC
DISPLAY 'Done!'
END-PROC
Thanks to everyone for their help, and to you, BubbaDog for the winning code!
And just I trying to point out in post 18, the first argument is not in the lookup range in BubbaDog’s solution.
That’s great.
I figured that the problem was caused by “programmer logic” when dealing with Excel.
Excel has a limitation which runs somewhat against the way a programmer attacks a problem.
A formula in Excel can only put it’s results in the cell in which it resides.
As a programmer you were expecting each formula to place it’s result somewhere else (the row where it matched). That’s what the command line of a program would normally do. So you’re choice of key and search column were correct for that process.
But excel can only place the results of a cell’s task within that cell. That limitation causes the key and search column to swap. The formula was working correctly and so is the new one.
I figured that out when I was finally able to view your spread sheet and explanation this morning on my PC. Last night I used my IPAD which didn’t format the window properly and the fields of your example ran together. This morning I was able to tell that the formula was working perfectly in Excel but your explanation of why it wasn’t working tipped me off that Excel needed to sample one value from column A and compare it to many values in column T in order to present the results the way you wanted.
He was fighting more than one misconception in this process. That’s why I just wrote out the formula instead of trying to explain some more Excel rules.
Now that he has a working example of what he wanted to accomplish he can hopefully get a better grasp of how Excel function logic works. At least that’s how the Excel learning curve worked for me. Once I was able to see a function working on a problem of mine it made it a little bit easier for me to understand exactly how the function works.