Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Default help writing formula to merge two worksheets

I need help writing a formula. I am trying to update one worksheet based on a matching column from another worksheet.

Worksheet 1: ecEveryoneElse
The NewUserName column in this worksheet contains the new data. There are 98000 records in this worksheet.
Code:
+---------------+---------------+
| A | B |
+---------------+---------------+
| UserName | NewUserName |
+---------------+---------------+
| 3282384 |2wsUShrwj45h |
| 2293848 |38Ssjdjr423s |
| 2047765 |2OSIv0s4i348 |
+---------------+---------------+
Worksheet 2: llo_studentsdemo
The myNewID (B) column in this worksheet needs to be updated when id matches UserName from the other worksheet. There are 133000 records in this worksheet. I need to do this for all records in this worksheet. Also, there are several records with matching id values in this worksheet.
Code:
+---------------+---------------+---...
| A | B | C
+---------------+---------------+---...
| id | myNewID | nextColumn
+---------------+---------------+---...
| 3282384 | (value is 2wsUShrwj45h after query runs)
| 2293848 | (value is 38Ssjdjr423s after query runs)
| 2047765 | (value is 2OSIv0s4i348 after query runs)
+---------------+---------------+---...
Here is what I want to do:

if ecEveryoneElse.UserName = llo_studentsdemo.id
set llo_studentsdemo.myNewID = ecEveryoneElse.NewUserName
end

Any help writing this formula would be very much appreciated.

Thank you.

Mike
  #2   Report Post  
Senior Member
 
Location: Belo Horizonte, Brazil
Posts: 170
Thumbs up

Quote:
Originally Posted by mrfisherman2010 View Post
I need help writing a formula. I am trying to update one worksheet based on a matching column from another worksheet.

Worksheet 1: ecEveryoneElse
The NewUserName column in this worksheet contains the new data. There are 98000 records in this worksheet.
Code:
+---------------+---------------+
| A | B |
+---------------+---------------+
| UserName | NewUserName |
+---------------+---------------+
| 3282384 |2wsUShrwj45h |
| 2293848 |38Ssjdjr423s |
| 2047765 |2OSIv0s4i348 |
+---------------+---------------+
Worksheet 2: llo_studentsdemo
The myNewID (B) column in this worksheet needs to be updated when id matches UserName from the other worksheet. There are 133000 records in this worksheet. I need to do this for all records in this worksheet. Also, there are several records with matching id values in this worksheet.
Code:
+---------------+---------------+---...
| A | B | C
+---------------+---------------+---...
| id | myNewID | nextColumn
+---------------+---------------+---...
| 3282384 | (value is 2wsUShrwj45h after query runs)
| 2293848 | (value is 38Ssjdjr423s after query runs)
| 2047765 | (value is 2OSIv0s4i348 after query runs)
+---------------+---------------+---...
Here is what I want to do:

if ecEveryoneElse.UserName = llo_studentsdemo.id
set llo_studentsdemo.myNewID = ecEveryoneElse.NewUserName
end

Any help writing this formula would be very much appreciated.

Thank you.

Mike
-------------------------------------------------------------------------

Dear Mike, Good Morning.

You can use the VLOOKUP FUNCTION.
It was specially designed for kind of search.

The use of ISERROR FUNCTION is proper to prevent message error in case the searched id were not found.

Using your example as a reference DO:

Worksheet 2: llo_studentsdemo

A2 -- =IF(ISERROR(VLOOKUP(A2,ecEveryoneElse!A:B,2,FALSE) ),"--- ID NOT FOUND ---",VLOOKUP(A2,ecEveryoneElse!A:B,2,FALSE))

Copy this formula until the last filled line of records

Tell me if it worked for you.

Feel free to ask anything about it.
__________________
I hope it can help you.

Best regards,
Marcilio Lobão
---------------------------
Belo Horizonte, Brazil
  #3   Report Post  
Junior Member
 
Posts: 2
Default

Dear Mazzaropi,

This worked! Thank you so much for your help.

Mike
  #4   Report Post  
Senior Member
 
Location: Belo Horizonte, Brazil
Posts: 170
Thumbs up

Quote:
Originally Posted by mrfisherman2010 View Post
Dear Mazzaropi,

This worked! Thank you so much for your help.

Mike
-------------------------------------------------------------------------

Dear Mike,

You´re welcome.

I feel happy helping you in your needs.
__________________
I hope it can help you.

Best regards,
Marcilio Lobão
---------------------------
Belo Horizonte, Brazil
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing macro to format multiple worksheets? StevenC New Users to Excel 1 October 2nd 07 03:07 PM
help in writing a formula Soth Excel Worksheet Functions 4 February 2nd 07 12:22 AM
Writing a Formula sadman49 Excel Discussion (Misc queries) 5 November 24th 06 08:03 PM
Need help with writing formula please... Soth Excel Worksheet Functions 1 March 14th 06 07:03 PM
Merge =( formula should retain fraction type numbers after merge. Aubrey Excel Worksheet Functions 0 February 9th 06 07:37 PM


All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"