Calculate check boxes in percentage - InfoPath Dev
in

InfoPath Dev

Calculate check boxes in percentage

Last post 12-02-2012 08:09 PM by Jimmy. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 11-29-2012 02:32 PM

    Calculate check boxes in percentage

    I have 5 check boxes (field9-field13) that the cleared field are set to 0 and checked values are set to 1. I want to calcuate all the checked fields divided by 100%.  I have tried to enter in the fx calculation in  field8 suc as (ROUND((field9)/10,0)+......... ROUND(field10)/10,0))* 2

     How would I calculate the percentage in field8? Or is there another way to do this?

  • 11-29-2012 03:56 PM In reply to

    Re: Calculate check boxes in percentage

    Hi Dawg62 and welcome,

    I would try something like this: concat(floor(count(*[not(*)][. != ""]) / count(*[not(*)]) * 100), "% of this section has been completed.")

    Good luck!

    Patrick Halstead
    Project Manager at Qdabra
  • 11-30-2012 06:56 AM In reply to

    Re: Calculate check boxes in percentage

    Where would I insert the field names such as field9, field10, field11, field12, and field13?  Those are the fields I will want to add and give a percentage from the 5 fields. Do I actuallinsert this in the calculation:  "% of this section has been completed.  I'm thinking of changing the fields to a drop down box with the values of Yes, No, and N/A.  I would want to calcualte the yes and N/A as the percentage and no would like being unchecked and not counted giving me a negative.  Example: 4 boxes show Yes or N/A so the percntage would be 80%.  I would like to this instead if it can be done.

     Thanks!

  • 11-30-2012 07:14 AM In reply to

    Re: Calculate check boxes in percentage

    So you have 5 checkboxes in your form that can have the value 1 or 0, and you want to find the percentage that are checked?  If so, I imagine this should work:

    (field9 + field10 + field11 + field12 + field13) div 5

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-30-2012 07:22 AM In reply to

    Re: Calculate check boxes in percentage

    This is the error I am getting: "field9" does not point to a valid location path of a field or group. Field8 holds the calculation. I like to be able to use the Yes, NA valued as 1 and No valued as 0 to get the percentage I need.
  • 11-30-2012 07:29 AM In reply to

    Re: Calculate check boxes in percentage

    You'll need to actually select the fields using the Select a field or group... button.  You can't just type field9.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-30-2012 07:37 AM In reply to

    Re: Calculate check boxes in percentage

    I have the check boxes in a table format. Not sure how to select field or gropup from filed8 that does the calculations.  There is nothing under Text Box Properties that gives me those choices.  Is there a site that explains how to do what I need?

    Thanks!

  • 11-30-2012 07:43 AM In reply to

    Re: Calculate check boxes in percentage

    The button would be in the formula editor, where you enter the formula:

    I misspoke when I said "Select field or group".  It should have been "Insert field or group".

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-30-2012 08:06 AM In reply to

    Re: Calculate check boxes in percentage

    This is the error I am getting after I select the fields to calculate: The formula contains one or more errors.

     "../my:field9../my:field10../my:field11../my:field11../my:field12../my:field13" does not point to a valid location path of a field or group.

    This is the calculation I selected and as it was entered in as I select each field name.

    (../my:field9../my:field10../my:field11../my:field11../my:field12../my:field13) / 5

    Data type is set to decimal.  I have tried Text and Whole Number (integer) as Data Type.

    I can't get either to work.

    I tried to copy the form in and what the page looks like but can't figure out how to do it on this site.Can't find the option to do it...

  • 11-30-2012 08:16 AM In reply to

    Re: Calculate check boxes in percentage

    I changed the text box to fx Calculated Value and when I enter the value it says there is no errors now.  This is what is shown in the value box. 1.#QNAN

    When I go to preview and check the boxes nothing happens.  The same value in the box remains.  Getting closer, I think...

  • 11-30-2012 08:24 AM In reply to

    Re: Calculate check boxes in percentage

    I figured out the problem.  I didn't have all the check boxes set to 0 and 1 but to true and false.  Now it works.  But how to show a % sign witht the value?  I like when things finally come together.

  • 11-30-2012 08:55 AM In reply to

    Re: Calculate check boxes in percentage

    How do you calculate a repeating table to show the percentage as it grows? If there are 7 rows but only 4 are checked yes, how would I calulate that? Is it possible?

     I'd send you a copy of the form but don't know how to attach it to this blog.

  • 12-02-2012 08:09 PM In reply to

    Re: Calculate check boxes in percentage

    You can attach your form by using the Options tab when you hit Reply.

    It should be possible to do what you're looking to do, but I'm not entirely clear on what that is.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (13 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.