Excel VBA and SQL Server Stored Procedure Evaluating an Excel Empty Cell


I have an macro and spreadsheet that contains the following columns: studentname, course, startdate, enddate and enrollmentstatus. I have a Microsoft SQL Server stored procedure that evaluates each row in the Excel spreadsheet. If today's date is between the startdate and enddate then the enrollment status is set to "ActiveEnrollment". If today's date is less than the startdate or today's date is greater than the enddate then the enrollmentstatus is set to "InactiveEnrollment". If the startdate field is empty in Excel then I want to return "RegistrationIncomplete".

The stored procedure can evaluate the startdate and enddate cells if there is a date. However, I am not able to code the stored procedure to properly evaluate the empty cell.

I have included a script with the stored procedure (studentcoursevalidation) and a table (StudentCourseEnrollment). Also attached is the Excel Spreadsheet with the macro.

I would appreciate assistance in finding out how to properly evaluate an empty cell in Excel using a SQL Server stored procedure.

Thanks in advance.
Rob M.Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
use "Is null" for blanks:


 when @startdate is null then 'RegistrationIncomplete' end enrollmentstatus

Open in new window

or if you wanted to do both:
 when isnull(@startdate,'') = '' then 'RegistrationIncomplete' end enrollmentstatus

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob M.Author Commented:
Thanks very much. I appreciate you answering my question so quickly.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.