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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bit of Excel Coding

Status
Not open for further replies.

schnabs

Technical User
Jan 21, 2009
50
Hello,
I have two sheets. Sheet 1 has all of my information on it, save one column of data, which is on sheet two. I need to check to see if the name on sheet1 matches the name on sheet 2. If it does, I want to populate the cell in sheet1 with the data from 2, for each customer. My problem is, on sheet1, the customers have spaces inbw each name, so while customer 1 is in a1, customer 2 might be in a4 or a5. On sheet 2, they are in numerical order.
Thanks in advance for all your help.
 



Hi,

Please post examples that demonstrate your dilema. Be sure to post CORREPSONDING samples from both lists.

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Sure thing.
Here is what my data looks like.
Sheet1
Column A Column I
Row1 Bill
Row2
Row4
Row4
Row5 Tom
Sheet 2

Column A Column I
Row 1 Bill Cleared
Row 2 Tom Pending
Row 3 Zack Cleared
Row 4 Bob Cleared
Row 5 Erica Pending

I need a macro/statement that would check if it says Bill on both sheet 1 and sheet 2, it would populate column I on sheet 1 with the data from column I on sheet 2. My problem is, the spaces between the names. Row 2 sheet 2 column A equals Tom, but Tom is on sheet 1, row 5 column A.
 
Do you need this to be a macro? Or are you able to use a vlookup in column I on Sheet 1?

Code:
=IF(COUNTBLANK(A1)>0,"",VLOOKUP(A1,Sheet2!$A$1:$I$5,9,FALSE))

gives you the following:

Column A Column I
Row1 Bill Cleared
Row2
Row4
Row4
Row5 Tom Pending
 



"My problem is, on sheet1, the customers have spaces inbw each name"

This is a similar problem as your had in one of your other threads, where you had to delete ALL the rows of customers with ZERO balances.

I gave you an example of a METHOD. The same METHOD can be applied in this instance, looking at the NAME rather than the AMOUNT.

You ought to be able to apply this method to this new case. One caveat, might be that if you have a Total Robert then you are going to have to find the Robert part, so your formula might look something like this...
[tt]
B1: =if(a2="",b1,if(left(a2,5)="Total",right(a2,len(a2)-6),a2))
[/tt]


Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top