Hi All I am just trying to write my first bit of VBA and have found it quite easy however I have then come to input the formula in my cell and it doesnt work. I have created a lot of variations within the VBA saving each version but I always get a error usually #REF #VALUE or #NAME - when these appear I use the excel help with no avail. My spreadsheet is customer type column b and quanitity of books column c My function / formulae is being entered into column D = Discount (B4,C4) My VBA forst draft is below... Function Discount(Customer_Type As String, Quantity_of_bks As Integer) If Customer_Type = "Individual" And Quantity_of_bks < 5 Then Discount = 0# If Quantity_of_bks >= 5 And Quantity_of_bks < 24 Then Discount = 0.15 If Quantity_of_bks > 25 Then Discount = 0.25 ElseIf Quanitity_of_bks < 5 Then Discount = 0.05 If Quanitity_of_bks >= 5 < 14 Then Discount = 0.1 If Quantity_of_bks >= 15 < 24 Then Discount = 0.15 If Quantity_of_bks >= 25 < 49 Then Discount = 0.2 If Quantity_of_bks > 50 Then Discount = 0.3 End If End Function Things I have tried include an End IF after the first IF and an END If at after every line I have also tried writing in the other customer types options so instead of having an Else IF I have another IF e.g. If Customer_Type = "Educational Inst" or "Library" or "School" And ....... Nothing seemed to create a result when the function is input in the cell. I am not sure whether my VBA is incorrect or the Formulae. I dont even mind if I get an incorrect answer I can amend the VBA but I cant get past the errors. Can anyone help? Thanks Rache ************************************************************* You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or MicrosoftOffice@xxxxxxxxxxxxxxxx To send mail to the group, simply address it to mso@xxxxxxxxxxxxx To Unsubscribe from this group, visit the group's homepage and use the dropdown menu at the top. This will allow you to unsubscribe your email address or change your email settings to digest or vacation (no mail). //www.freelists.org/webpage/mso To be able to share files with the group, you must join our Yahoo sister group. This group will not allow for posting of emails, but will allow you to join and share problem files, templates, etc.: http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE SHARING ONLY. If you are using Outlook and you see a lot of unnecessary code in your email messages, read these instructions that explain why and how to fix it: http://personal-computer-tutor.com/abc3/v28/greg28.htm *************************************************************