locked
Calculate Percentage RRS feed

  • Question

  • In a Netball database I have created a Query containing a column for Number of "Attempted Goals" and a column for number of "Goals" scored. Now I need a column in the Query "Percentage of Goals"scored. What is the formula in Criteria for calculating the Percentage of Goals scored. Say a Player has 34 Attempts at Goal and only 23 Goals scored. Thank you
    Thursday, September 17, 2015 6:23 PM

Answers

All replies

  • Percent_Goals: [Goals]/[Attempted Goals] *100

    Build a little, test a little

    Thursday, September 17, 2015 6:31 PM
  • Depending on the version of Access, you can use a calculated column in the Table instead.

    As far as in a query you could use something like

    CalcField: ([field1]/[field2]*100)

    Added missing bracket


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012


    • Edited by KCDW Thursday, September 17, 2015 6:56 PM 2015 09 17 added missing bracket
    Thursday, September 17, 2015 6:32 PM
  • CalcField: ([field1]/[field2*100)

    I would wrap this, like CalcField:IIF(Field2 <> 0, [field1]/[field2],0) and format the display as percentage.

    But even this doesn't go far enough. A further check would be to check [field2] with Nz to avoid nulls. Data are evil.


    peter n roth - http://PNR1.com, Maybe some useful stuff

    Thursday, September 17, 2015 6:42 PM
  •  Or perhaps

    CalcField: (NZ([field1],0)/NZ([field2],0)*100)


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Thursday, September 17, 2015 6:55 PM
  •  CalcField: (NZ([field1],0)/NZ([field2],0)*100)

    Hi,

    Take care! Division by 0 gives an error! See Peter's answer, and exclude; field2 = 0, or Nz(field2) = 0

    Imb.

    Thursday, September 17, 2015 7:45 PM