SUMIF or similar function in Infopath??? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

SUMIF or similar function in Infopath???

Last post 08-08-2018 11:20 AM by RaYvA. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 05-20-2014 09:15 PM

    SUMIF or similar function in Infopath???

    Hello I am very new at using InfoPath forms and SharePoint Lists and have learned everything by watching youtube videos so my knowledge is limited. I have successfully created a form for work (which is why its in Spanish) that will help tremendously but I have 1 issue, there is one control field (field25) under "Total de Gasto" in which I need all the fields under "subtotal" (field8, field11, field14)  to add up but only if the field under "reembolsable?" says "Si" (field27, field28, field29). I have managed to do this in excel with the SUMIF function but this is not one of the function options when editing the field. Can anyone tell me if this is even possible? If so, please help me figure out the function I need to use. Thank you in advance for any help you can provide.


  • 05-22-2014 06:18 AM In reply to

    • RaYvA
    • Top 100 Contributor
    • Joined on 05-09-2013
    • Melbourne, Australia
    • Posts 86

    Re: SUMIF or similar function in Infopath???

    Congratulations on being an new IntoPath'r/SharePoint Guru.

    I couldn't see from your screenshot, are the fields you want to sum in a repeating table/section? You would want to put them in a repeating table/section!  When you do have them in a repeating table/section then the solution becomes relatively easy.  I have added a form for you to look at that replicates the following screenshot.

     

     What you need to do is add a filter to your SUM condition (which creates the IF.. before the SUM) so in my example:

    sum(../my:group1/my:group2/my:field2[../my:field3 = string(true())]) the bold is the IF statement.

    When you are setting up your summation you have to select the 'Filter Data' button in InfoPath to do this:

    You will get lots of dialog boxes and your screen will look similar to this:

     

    Have a look at the form I attached, you'll work it out, you've done a really good job so far.

    Good luck

  • 05-22-2014 06:40 AM In reply to

    • RaYvA
    • Top 100 Contributor
    • Joined on 05-09-2013
    • Melbourne, Australia
    • Posts 86

    Re: SUMIF or similar function in Infopath???

    Sorry I deleted the previous post as the sreenshot is missing I pasted it in and it looked ok at my end, but it didn't seem to didn't post, now I've appended a screenshot and it wont preview!

     

    If all else fails look at the XSN I appended in a previous post

     


  • 05-22-2014 07:54 AM In reply to

    Re: SUMIF or similar function in Infopath???

    Thank you so much for your help! I initially did not have the subtotals in a repeating table but I did figure out that I needed to do that so it is in a repeating table now. I tried to figure out the formula with the IF statement but I am getting an error and I'm not sure what I'm doing wrong.

    Here is my formula:  sum(../my:group15/my:EXPENSE_ENTRIES/my:SUBTOTAL[../my:group15/my:EXPENSE_ENTRIES/my:REEMBOLSABLE[. = "SI"]])

    Here is the error:  "../my:group15/my:EXPENSE_ENTRIES/my:group15/my:EXPENSE_ENTRIES/my:REEMBOLSABLE" does not point to a valid location path of a field or group.

  • 05-22-2014 09:24 AM In reply to

    Re: SUMIF or similar function in Infopath???

    Maybe:

    sum(../my:group15/my:EXPENSE_ENTRIES/my:SUBTOTAL[../my:REEMBOLSABLE[. = "SI"]])

    EDITED TO ADD:

    or just:

    sum(../my:group15/my:EXPENSE_ENTRIES/my:SUBTOTAL[../my:REEMBOLSABLE = "SI"])

    Hilary Stoupa

  • 05-22-2014 09:44 AM In reply to

    Re: SUMIF or similar function in Infopath???

    The first option worked perfectly! Thank you to both of you for your help!

  • 08-08-2018 07:31 AM In reply to

    Re: SUMIF or similar function in Infopath???

    Just wanted to say that this piece of code worked like a charm and saved my life - thank you so much for sharing!!
  • 08-08-2018 11:20 AM In reply to

    • RaYvA
    • Top 100 Contributor
    • Joined on 05-09-2013
    • Melbourne, Australia
    • Posts 86

    Re: SUMIF or similar function in Infopath???

    Thanks for understanding :P (And after all this time, woohoo) Hope you do well.
Page 1 of 1 (8 items)
Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.