Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Changing 2 cells based on another cell

I have a spreadsheet that has teachers first names in column A and their last
names in column C. Their room number is in column F. I need to change the
teachers' first & last names based on the room number. The problem I am
encountering is there is about 75 teachers, much more than the IF function
will handle. For some reason when we pull our report out of the system to
Excel, the teachers names are not acurrate to the rest of the report.

Please help.

Jase4now
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Changing 2 cells based on another cell

On 26 Aug, 12:22, Jase4now wrote:
I have a spreadsheet that has teachers first names in column A and their last
names in column C. Their room number is in column F. I need to change the
teachers' first & last names based on the room number. The problem I am
encountering is there is about 75 teachers, much more than the IF function
will handle. For some reason when we pull our report out of the system to
Excel, the teachers names are not acurrate to the rest of the report.

Please help.

Jase4now


Use the VLOOKUP function.

You will have to put the room number in column A though and then look
up the room number and return the teachers name. This is because (I
believe) VLOOKUP can only look left to right and not right to left.

Chrisso
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Changing 2 cells based on another cell

Is there any code I can write that would do this automatically? I can't move
the room number, because I send this report to a different system. The
columns must stay where they are.

Thanks for trying though

"Chrisso" wrote:

On 26 Aug, 12:22, Jase4now wrote:
I have a spreadsheet that has teachers first names in column A and their last
names in column C. Their room number is in column F. I need to change the
teachers' first & last names based on the room number. The problem I am
encountering is there is about 75 teachers, much more than the IF function
will handle. For some reason when we pull our report out of the system to
Excel, the teachers names are not acurrate to the rest of the report.

Please help.

Jase4now


Use the VLOOKUP function.

You will have to put the room number in column A though and then look
up the room number and return the teachers name. This is because (I
believe) VLOOKUP can only look left to right and not right to left.

Chrisso

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Changing 2 cells based on another cell

You can write code to do anything. If you are asking someone to write
the code for you then you may be disappointed.

Psuedo code would be:
* walk over every entry in your export extracting the room number
* search for the room number in a lookup list on a seperate book/
sheet
--- the lookup list has the correct room number to teacher
mapping
* when you find the room number row then lookup the correct teacher
* enter this back into the export over the incorrect teacher
* move down a row at a time and repeat
* stop when there is no more data

Here are some code stubs for some of these steps:

Sub Find_Value(sValue As String)
Dim rFinder As Range
Set rFinder = YourSheet.Column(<ROOM NUMBER COLUMN).Find(sValue)
if rFinder Is Nothing
MsgBox sValue & " cannot be found."
Else
MsgBox sValue & " found on row " & rFinder.Row
End If
End Sub

Sub Loop_Over_Data()
Dim rCell As Range
Set rCell = YourSheet.Cells(1, 1)
Do While rCell.Value < vbNullString
' do something ====================

' next row of data:
Set rCell = rCell.Offset(1, 0)
Loop
End Sub

Note: this wont compile until you replace "YourSheet" with a valid
Worksheet object and "(<ROOM NUMBER COLUMN" with a column number

Chrisso
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
Changing Cell Background Color based on data from another cell Speedy Excel Discussion (Misc queries) 2 March 16th 09 04:10 PM
Changing cell text color based on cell number W. Wheeler Excel Programming 0 April 22nd 07 11:56 PM
Changing a cells type based on it's value Keith Excel Worksheet Functions 2 April 18th 07 01:34 PM
Changing cell text color based on cell number scotty Excel Programming 9 April 14th 07 06:34 AM
Changing the color of a cell and adjacent cells based on conditions Matt[_42_] Excel Programming 2 September 6th 06 01:34 PM


All times are GMT +1. The time now is 02:09 PM.

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"