You are viewing limited content. For full access, please sign in.

Question

Question

SUMIF

asked on December 2, 2015 Show version history

I am trying to create a form that would sum the line items based on criteria like what you would do with SUMIF in an excel spreadsheet.  For example I would like to sum the line items that are for Admin and have account 7196 only.

 

 

0 0

Replies

replied on December 4, 2015

Hello Will,

Currently SUMIFS is not supported as it is not part of the OpenFormula standard, but I have put in a feature request to support the formula in a future release. For now, the following JavaScript should suffice, just a minor tweak to the existing code:

$(document).ready(function () {
  $('.cf-table-block').on('blur','input',sumtotal);
  $('.tax').on('blur','input',sumtotal);
  $('.shipping').on('blur','input',sumtotal);
  function sumtotal() {
    var sum = 0;
    $('.cf-table-block tbody tr').each(function () {
      var s = 0;
      s = parseNumber($(this).find('.price input').val()) * parseNumber($(this).find('.quantity input').val());
      $(this).find('.subtotal input').val(s);
      if (($(this).find('.department select').val() == "Admin")
         && ($(this).find('.id input').val() == "7196")) {
      	sum += s;
      }
    });
    $('.total input').val(sum);
  }
  function parseNumber(n) {
    var f = parseFloat(n);
    return isNaN(f) ? 0: f;
  }
});

Note that to use this code as-is, you must set the GL Account ID to have the class "id" (which admittedly is probably not the best name given CSS terminology...) in order to check its value.

Hope this helps!

1 0
replied on December 4, 2015

Awesome James, thank you for the feature request.

0 0
replied on December 3, 2015

Just thought I would post a link to may unaswered post as well.  This is exactly what we are trying to accompish.  We are able to get the SUMIF to work with one criteria.  However we also need to check two criteria.

https://answers.laserfiche.com/questions/87803/Forms-10-Calculations

0 0
replied on December 9, 2015

That worked.  Thank you!

0 0
replied on April 28, 2016

Hi,

SUMIFS is supported in Forms 10.1.

SUMIFS( Reference R ; Reference R1 ; Criterion C1 [ ; Reference R2 ; Criterion C2 ]... )

Thank you.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.