Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Compare & Append Question

Status
Not open for further replies.

Therber

Programmer
Nov 20, 2000
10
US
I'm working on the following problem: (if anyone knows of any posts with a similar solution, just point me to it)
I have two columns in Excel. Column A has various UPC codes and column B has corresponding item numbers. Some numbers in column B have two letters as a prefix and some don't. (I need to append two letters to all entries that do not have the letters - and the UPC codes vary).
First, I need to read the first six digits in the 12 digit UPC code in column A. If they are equal to, let's say "123456", then move to column B. If the first character in column B is not a letter, then append "XY" as the prefix. So if column B had 4536, it would end up with XY4536. Then repeat until the end of the entries.
I'm going to look for a good book on VBA. Thought I'd ask in the meantime.
Thank You.
 
Try:

IF(LEFT(A1,6)="123456",IF(LEFT(B1,2)="XY,B1,"XY"&B1,"")

in C1 and copy down



Blue [dragon]

If I wasn't Blue, I would just be a Dragon...
 
opps, missed a quote

IF(LEFT(A1,6)="123456",IF(LEFT(B1,2)="XY",B1,"XY"&B1,"")

Blue [dragon]

If I wasn't Blue, I would just be a Dragon...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top