Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Return column heading

Hi
I have a large list of pupils effort grades within the subjects that they
are studying: the list of all the subjects (about 18) is in row 1, pupil
names in column 1. If John Smith is studying music, and is awarded a 'A',
how can I search the row for the 'A', and return the column heading (i.e.
Music)? I've tried lookups and match and offset, but to no avail. I'm
obviously missing something...

Thanks
Tubthumper
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Return column heading

See:

http://www.cpearson.com/excel/TablesAndLookups.aspx

--
Gary''s Student - gsnu200781


"Tubthumper" wrote:

Hi
I have a large list of pupils effort grades within the subjects that they
are studying: the list of all the subjects (about 18) is in row 1, pupil
names in column 1. If John Smith is studying music, and is awarded a 'A',
how can I search the row for the 'A', and return the column heading (i.e.
Music)? I've tried lookups and match and offset, but to no avail. I'm
obviously missing something...

Thanks
Tubthumper

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Return column heading

Thanks for the link - some useful tips there for me. However, because I
don't know which column has the 'grade', I can't get it to look across the
row, find the 'A', and then return the column heading for that 'A'.

Here's hoping!



"Gary''s Student" wrote:

See:

http://www.cpearson.com/excel/TablesAndLookups.aspx

--
Gary''s Student - gsnu200781


"Tubthumper" wrote:

Hi
I have a large list of pupils effort grades within the subjects that they
are studying: the list of all the subjects (about 18) is in row 1, pupil
names in column 1. If John Smith is studying music, and is awarded a 'A',
how can I search the row for the 'A', and return the column heading (i.e.
Music)? I've tried lookups and match and offset, but to no avail. I'm
obviously missing something...

Thanks
Tubthumper

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Return column heading

Hi,
What if the student has more than 1 "A"?
Do you want a list of subjects for which he got an "A"?
Regards - Dave.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Return column heading

Actually, that's it exactly! A list of all the subject for all the
students...it sounds so easy!!

Thanks


"Dave" wrote:

Hi,
What if the student has more than 1 "A"?
Do you want a list of subjects for which he got an "A"?
Regards - Dave.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Return column heading

Hi,
Put this macro into a module and run it.
Answer the questions it asks.
Is the result roughly what you want?

Sub ListSubjects()
Dim Grade As String
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
A = InputBox("What is the Row Number of the first student?")
B = InputBox("What is the Column Number of the first Subject?" & Chr(10) &
"(A=1, B=2 etc)")
C = InputBox("What is the Row Number or your subject headers?")
D = InputBox("What is the Column Number of your student names?" & Chr(10) &
"(A=1, B=2 etc)")
E = InputBox("What column would you like the results put into?" & Chr(10) &
"(A=1, B=2 etc)")
Grade = InputBox("What grade do you want listed?")
Do Until Cells(A, D) = ""
For i = 1 To 18
If Cells(A, B) = Grade Then Cells(A, E) = Cells(A, 20) & " " & Cells(C, B)
B = B + 1
Next i
B = 2
A = A + 1
Loop
End Sub

You'll have to unwrap any lines that have been wrapped by this newsgroup
format.
Be sure to input Column Numbers when asked (1, 2, 3 etc - not A, B, C etc)
Regards - Dave.
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
*HELP* Need a cell to return a column heading dan Excel Discussion (Misc queries) 4 August 15th 07 08:19 PM
Return Column Heading after lookup Javier Diaz[_2_] Excel Worksheet Functions 1 August 3rd 07 07:36 PM
LOOKUP and return the column heading for IF/THEN return for False NN Excel Discussion (Misc queries) 1 October 6th 06 11:24 AM
I have an IF formula to return column heading for FALSE NN Excel Discussion (Misc queries) 7 October 5th 06 10:45 PM
Formula to Return Column Heading den4673 Excel Discussion (Misc queries) 4 February 13th 06 09:55 PM


All times are GMT +1. The time now is 06:23 AM.

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"