You are here:

Excel/User-Defined Function and Vlookup


QUESTION: 1. I chanced upon on of your examples on UDF -

i would like to ask, if i can change the "Grade" to 2 words instead of 1? because when i try to change to 2 words, it got an error.

2. Am i allow to derive to an answer of 'YES' or 'No' using Vlookup on other documents which contains a lot of data. For example, my cell C1 will be a 'YES' if it vlookup in another excel worksheet for a particular name and if the name is not found in that another excel sheet, my cell C1 will be a 'NO'

Please advice. Thanks

ANSWER: question was found in the question pool - I'm happy to try to help, but it would be good to know what problem YOU are trying to solve - I can see the original answer, but I'd rather ensure you had a suitable answer for your problem - which may NOT need a UDF.  In the UDF given, the output is a string, so you can have any length you want without it causing a problem (but you do need to leave the quotes in - for instance "Mark A")

For your second part, it sounds as though this is an IF statement, probably with a countif.

[an error occurred while processing this directive]---------- FOLLOW-UP ----------

QUESTION: for question 1, i needed to allocate my class accordingly. so for instance, if i enter class A, i will have 35 students. if i enter class B, i will have 50 students. it will have more than 7 statements, hence, i was not able to use the IF formula.

for question 2. i need to know whether this particular student is suitable for a particular program. hence, a list of student is found in another excel file. So on one fresh excel sheet, i would like to have a formula that when i enter this person name, the cell will automatically inform me  a "yes", which means, he/she is eligible

Question one sounds like a case for VLOOKUP - with the data stored on the spreadsheet somewhere (which makes it easy to update) vlookup will return the number in the class.  For question two, IF that file is external and open, then COUNTIF will do it - if the file is external and NOT open, I'm not sure any function would work (by OPEN I mean you have both workbooks open at the same time, and by External I mean workbook rather than worksheet in the same workbook).

If it helps with any follow ups, my direct email is
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Aidan Heritage


I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world! As AllExperts closes down, just google me to find my details - I will still be around answering questions!


My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!

©2017 All rights reserved.

[an error occurred while processing this directive]