ACCESS VBA MACROS EXERCISES▼
Access VBA Macros | Creating functions exercise | Calculate oscar success rate using function
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
You can learn how to do this exercise on the relevant Wise Owl classroom training course (sadly for the moment only in the UK).
You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Create a new module called modFunctions.
Create a function within this module to calculate the Oscar success rate for any film. The inputs to your function will be:
- The number of Oscar nominations for the film
- The number of Oscar wins for the film
The output from your function is a single number, giving the win percentage (esssentially, one number divided by the other). Be careful of films which didn't receive any Oscar nominations!
Test out your function using the immediate window:
Three tests for your function - each time it is returning the correct percentage
Finally, create a new query incorporating your function to show for each film its Oscar success rate:
How can a film win more oscars than it was nominated for? And how did the Matrix only win 4?
Save and close your module and query.