LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Need to do a SQL-like functions within Excel. Need HELP!

I have an Excel 2003 worksheet in which Column A contains Employee IDs
(ie 00123), Column D contains UserIDs, and Column G contains the
employee's Manager's Employee ID.

An employees Manager ID in Column G will appear later on in the
spreadsheet as its own employee record (Employee ID in Column A).

EXAMPLE:

ROW 1: Column A contains EmployeeID: 00012. Column D contains UserID:
rgrubin. Column G contains Manager ID: 00078.


ROW 670: Column A contains EmployeeID: 00078. Column D contains
UserID: jsmith. Column G contains Manager ID:00212

In this case rgrubin's manager is jsmith and jsmith's employee record
appears in Row 670.

What I need to do is in another column insert a employee's manager's
userid. So, in Row 1, I need to have a column that contains jsmith
which is rgrubin's manager's id. So, I am putting the UserID from Row
670 into a column in Row 1 and I need to do this in some sort of
formula or query since the spreadsheet has about 3000 rows and there
is no way I am going to sit there and manually match up employee IDs
with user IDs.

I don't want to have to bring the data into Access or SQL Server,
because this is a regular data dump from a PeopleSoft system in which
we have to convert the Excel to CSV which then gets converted to XML
for importing into another system.

Is there ANY way to do this directly within Excel?


This may not be pretty, but it works (at least for a small number of rows!!)

Sub copyManagerUserID()
Dim strManID
Dim strFoundUserID
For c = 2 To 25
strManID = Cells(c, 7)
Range("A:A").Select
Selection.Find(What:=strManID, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
strFoundUserID = ActiveCell.Offset(0, 3)
Cells(c, 10) = strFoundUserID
Next c
Range("A1").Select
End Sub


 
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
How to convert cell formula functions to code functions Adnan Excel Discussion (Misc queries) 1 October 1st 08 08:30 PM
formula/functions for average and if functions Petu71 Excel Worksheet Functions 2 August 5th 07 08:25 PM
efficiency: database functions vs. math functions vs. array formula nickname Excel Discussion (Misc queries) 2 July 14th 06 04:26 AM
Nesting functions in the functions dialog box cs170a Excel Worksheet Functions 0 June 10th 05 10:36 PM
excel functions and User defined functions Kanan Excel Programming 4 May 20th 04 11:21 PM


All times are GMT +1. The time now is 08:44 AM.

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

About Us

"It's about Microsoft Excel"