Excel Difficulty: Intermediate

Custom VBA Function for Excel Calculation

This prompt guides the user to create a custom VBA function in Excel that automates a specific calculation. It requires the user to specify the calculation to be performed and the input parameters needed for the function. The output will be a VBA function that enhances efficiency in data analysis.

The prompt

57 words2 blanks to fill in

Act as a professional Excel VBA developer with expertise in automation. Based on the provided [CALCULATION], placeholder and [PARAMETERS], placeholder, create a custom VBA function that accurately performs the specified calculation. Ensure the function is designed to automate a repetitive task and improve efficiency in data analysis. Deliver the results as a complete VBA function ready for immediate implementation.

Highlighted text is a blank. Swap it for your own detail before you send the prompt.

What Custom VBA Function for Excel Calculation produces

  • Function MyCustomFunction(param1 As Double, param2 As Double) As Double
  • MyCustomFunction = param1 + param2
  • End Function
  • Function CalculateAverage(paramArray() As Variant) As Double
  • Dim total As Double
  • Dim count As Integer
  • total = 0
  • count = 0
  • For Each num In paramArray
  • total = total + num
  • count = count + 1
  • Next num
  • CalculateAverage = total / count
  • End Function

How to use Custom VBA Function for Excel Calculation

Four steps, about a minute. Nothing to install and no account needed.

  1. Copy the prompt

    Use the Copy button above. The whole prompt goes to your clipboard exactly as written. Nothing is trimmed.

  2. Fill in the blanks

    Replace [CALCULATION] [PARAMETERS] with your own details. Everything in square brackets is a blank for you to fill in.

  3. Paste it into your assistant

    Checked against Mistral, ChatGPT, Claude. It is written as plain instructions, so paste it into whichever of them you already use.

  4. Read the result, then push back

    Compare what you get to the example below. If it is close but not right, say what to change: shorter, warmer, more specific, then ask again in the same conversation.

More prompts like Custom VBA Function for Excel Calculation

Close neighbours in Excel, by shared subject and tagging.

Share Custom VBA Function for Excel Calculation:

Reviews and questions

What other people got out of this prompt, and what they asked about it.

No reviews yet

Be the first to share how this prompt worked for you.