to do what?
you can use countif to count the number of names with a specific grade
or you could probably use a formula array to put all those name into other cells
you could use conditional formatting to change the colours of the cells for each grade
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
What i want is, I have 2 columns, 1 column is of names of individuals and 2nd column is of Grade. Now in a differently located cell if i write "C" then below that should appear all the names from Column 1 whose adjecent cell in 2nd column shows "C".
I tried using VLookUp formula but it is not giving me the correct answer.
I am not good with array... Could you please help me for that...
Just to tell you that i have 2000 or more rows with such data...
If you are happy with doing it directly on the data (and not a different location as you say) then just use AutoFilter. Have a look at AutoFilter in the Help file.
i could create a custom worksheet function to do what you want, but better to use inbuilt functions or methods wherever possible
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
TerryTee...
Auto filter is good and i have also used it but it would not give me an answer in a different column...
Westconn1...
I am not able to find out any inbuilt functions or method for sorting out my problem...
If you have anything which can help me or any function or method which can solve such query then please state the same...
Further to our conversation, it is not possible to do this with a native function. You will have to use VBA like Pete suggested. Instead of a function you could write a code for the worksheet selection change event which will capture the letter that you will type and then search for the names meeting that criteria and finally display them in the respective column....
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
this puts the names into the cells below the formula
put formual like =getgrades(C8:C17,"C") change range or grade to suit
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
i never saved it, but as the code is here it should be easy enough to do again
edit: don't know why there is error in the code, as i did test it just change the code in the function, the rest stays the same
vb Code:
Function getgrades(r As Range, grade As String) As String
Dim res() As Variant
i = 0
For Each c In r
If c.Offset(, 1) = grade Then ReDim Preserve res(i): res(i) = c: i = i + 1
Next
getgrades = ""
myarr = res
End Function
Last edited by westconn1; Dec 29th, 2009 at 03:56 PM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete