Ignoring NaN in number field on Validation of InfoPath form - sharepoint

I have a Purchase Order form which I need to calculate any entered values automatically (for totals, tax etc). Problem is, some of these fields in the InfoPath form have their default values as a calculation for this purpose. Fine.. but the problem then arises when a line is blank (there are 12 lines in the form but not all may be used in one PO). If a line is blank then the calculated fields will of course, display 'NaN'. For example the Quantity and Price fields are multiplied to make the total, then the total is multiplied by the tax percentage to get the net total. I attach a screenshot below for ease of understanding:
This is fine when it's line 1, as line 1 will definitely be filled in, but not for the others. See line 6 as a demo which is causing this problem. I have tried no default and '0' in the static fields, but neither works unless I put in an integer in (which then confuses users). The form validation insists that a number is in the number fields (not 'NaN'), so is there any way I can either ignore that on form validation, or find another workaround to solve this issue?
For reference, the calculations input as the default value for these are as follows:
Quantity: 0
Price per item: 0
Pre-tax price: Line6Quantity * Line6Price
VAT: (Line6Total - Line6SubTotal) / Line6Total
Line total: Line6SubTotal * (1 + Line6VAT)
As you can see, the VAT/Line Total fields are designed to be interchangeable, so people can fill in either/or. The form is being filled in from SharePoint.
Hope this all makes sense; help much appreciated.

You can make an easy workaround by checking the value in a function called before the form is submitted. So add an onClick="checkForNaN()" function to your submit form.
The isNaN() function should come in handy as you scan through the input boxes to check whether they evaluate to NaN. If so, simply change them to something acceptable to your form validation code.

Related

ordering a list of names based upon related values, accounting for duplicate values, excel

I have a sheet that pulls metrics regarding employees from an internal source, I am trying to create an end of day report card and would like to display the names in ranking order based upon the metrics.
a small example for demonstration:
Columns A and B: An example of the kind of data in my sheet.
column D: I have used a variation of
=INDEX(A$2:A$6,MATCH(E2,B$2:B$6,0))
Column E:
=LARGE(B$2:B$6,1)
as you can see I am running into trouble with duplicate 'total' values creating an incorrect index number causing the first name that matches to be the result.
column G i have attempted to get around this by using:
=INDEX(A$16:A$20,MATCH(E19,B$16:B$20,0)+COUNTIF(B$16:B$20,E19)-1)
to attempt to account for the duplicates by adding a countif to the index number, of course, is an incorrect approach.
Not shown I also tried adding 0.5/'employee id number' to the total (0.5/an integer gives me a decimal between 0 and 0.5 allowing me to have each number be unique without causing any rounding problems to the displayed total. However, I think the decimal was ignored by the MATCH and it made no effect.
A weird problem has had me puzzled and I appreciate any help!
Have you tried something like this
=INDEX($A$2:$A$6,AGGREGATE(15,6,(ROW($A$2:$A$6)-ROW($A$2)+1)/($E2=$B$2:$B$6),COUNTIF($E$2:E2,E2)))
=INDEX($A$9:$A$13,AGGREGATE(15,6,(ROW($A$9:$A$13)-ROW($A$9)+1)/($E9=$B$9:$B$13),COUNTIF($E$9:E9,E9)))
=INDEX($A$16:$A$20,AGGREGATE(15,6,(ROW($A$16:$A$20)-ROW($A$16)+1)/($E16=$B$16:$B$20),COUNTIF($E$16:E16,E16)))

Index with double Match returns incorrect closest values

I have an planning exported to Excel which looks like the following (tab ' Data'):
Each production line has a number of people working on it. Now is my goal to show how many people are working on a line per minute. We plan per product group, and several product groups combined form waht a line has to do per minute.
To get the production per minute I created the following (tab 'Conversie'):
=INDEX(Data!$H$2:$H$157;MATCH($N$1&A4;Data!$B$2:$B$157&Data!$C$2:$C$157;1))
In the example it works correct. However, the formula doesn't seem to always return the correct "Artikelomschrijving"(H) every time. I get incorrect return values when I extend this formula to other product groups.
I read that the data needs to be sorted ascending cause I use match_type 1. When I do that I get the right returns for some product groups, but the given example suddenly returns incorrect values.
I can't sort both column C and A in ascending order for the formulas to always return correct items. Can you help me to get past this hurdle?
After a little bit of google translate work, if I'm understanding your question correctly, you need to find the "Item Description" (H) of the record where the "Line" (B) = the value in N1 and the time is between the start and end times.
This is an array formula, you have to confirm it with Ctrl+Shift+Enter
=INDEX(Data!$H$2:$H$157,MATCH(1,(Data!$B$2:$B$157=$N$1)*(Data!$C$2:$C$157<$A2)*(Data!$D$2:$D$157>=$A2),0))
OR with semicolon syntax:
=INDEX(Data!$H$2:$H$157;MATCH(1;(Data!$B$2:$B$157=$N$1)*(Data!$C$2:$C$157<$A2)*(Data!$D$2:$D$157>=$A2);0))
I found the solution, thank you for pointing me in the right direction Valon Miller. This is the formula I fixed it with:
=ALS.FOUT(INDEX(Data!$H$2:$H$154;MATCH(1;(Conversie!L$1=Data!$B$2:$B$154)*((Conversie!$A32>=Data!$C$2:$C$154)*(Conversie!$A32<=Data!$D$2:$D$154));0));"")

Create an Excel Formula that uses filtered data

I'm trying to design a second page that shows % results of my data on page 1.
For example, Column F & G allow manual entry of numbers 1-4 which are based off data the user types in at another location.
This is being used for trade tracking in investments so there will be quite a few numbers but the end result will be a row will show a specific stock, it's subsequent data, whether it made or lost money, etc.
What I want to do in page 2 is using the numbers 1-4 which were typed in at columns F & G, translate that into an edge on page 2.
For example, if there were 50 columns of data typed out for trades executed, I could take the number of winning trades of a certain setup (say number 3) and divide that by the total trades of 50 to come out with a win % for that setup.
However, I have no clue to how to translate that forumla into a filter formula so that on page 2 I could see that of the numbers 1-4 (4 different setups) I could easily see the highest and lowest win % to determine the best setup to use.
I'm not the best in excel but I understand enough to code most of that, I simply have no idea how to take that end formula and add a filter to it so that it only uses partial results. I've got 4 other formulas I want to use on page 2 as well to help build something that could really benefit myself, but if someone could just show me how to filter data into a formula, I think I could take it form there.
Thanks for the help
Ben
You can also do something like this with array formulas
=MAX(IF(Sheet1!$F$2:$F$50=$A2,$E$2:$E$50))
(Press Ctrl+Shift+Enter [CSE], instead of just Enter when entering Array Formulas)
Also, take a look a the SUMPRODUCT function. It comes in very handy for filtering data. Here are some helpful links...
https://www.get-digital-help.com/2017/12/07/sumproduct-multiple-criteria/
https://www.get-digital-help.com/2017/12/08/sumproduct-and-if-function/
https://www.get-digital-help.com/2010/09/01/extract-a-unique-distinct-list-by-matching-items-that-meet-a-criterion-in-excel/

Using MIN function in excel when using mm:ss.00 fields and ignoring 00:00.00

Does anyone know how I can get excel to look at the following fields, all formatted in mm:ss.00 and return the lowest time. I am using this to calculate PB's - personal best times - in a sports club race sheet.
The formula I am using is
=MIN(J5,(U5),(AE5),(AO5),(AY5),(BI5),(BS5),(CC5),(CM5),(CW5),(DG5),(DQ5),(EA5),(EK5),(EU5))
The problem I have at the moment is that it is including 00:00.00 values in the cells and returning a MIN value of 00:00.00.
Any suggestions would be welcomed.
many thanks
Nigel
Use the following:
=SMALL((J5,U5,AE5,AO5,...),COUNTIF((J5,U5,AE5,AO5,...),0)+1)
COUNTIF counts the amounts of 0 (you maybe need to adjust this value based on your formatting, but it should work). SMALL returns the n-smallest number of the given matrix, with n being the counted value + 1.
Therefore if no 0 is in the matrix, you get the 1st-smallest (aka the smallest), with one 0 you get the 2nd-smallest and so on. Maybe you need to add a check if every value is 0, if that could happen, as in that case SMALL would try to retrieve the value on position list_size+1 of the list, which of course isn't present.

Crystal Reports - my formula works, but when repeated in more than 1 subreport, all records disappear

I'm not a developer but I'm supposed to create a report by C.R., so excuse me in advance if it is an obvious question for you, and please keep in mind that I'm a real beginner.
I have a job composed of 3 different workings (3 out of 5, which is the maximum workings I can have for a job).
In my SQL database, the table.field corresponding to those workings is job.phase, so when I put, in my report details, the field "job.phase", I get 3 rows for that job.
The point is that my report printout always has to show 5 different text objects (one below the other), corresponding to the descriptions of all the 5 possible table.field-records, and a 'X' should appear next to text objects when each one of the workings listed there is a part of my job (otherwise nothing should appear).
What I have done is the following:
- created a subreport containing the "job.phase" field
- put it near my first text object
- specified in my subreport the following "show string" formula:
if job.phase = 'working1' then 'X' else ''
and it works: a X appears if working1 is part of my job, nothing appears if working1 is not part of my job.
Then I have created 4 subreports more, equal to the first one, and specified the same for job.phase = working2, working3, working4 and working5, BUT, after doing that, no X is shown (even though working 1, 2 and 3 are part of my job)...
Is there anybody who can help me, please? It's so frustrating...
Using subreports for something like this is overkill for what you're trying to do and could be causing any number of things to behave badly. I'd recommend you abandon that idea. Here's how I would do it:
The first thing you'll want to do is group by job (if more than one will appear in your report, which I'll assume it will). The Group Footer section is where you can display the labels and Xs. You'll need to create 5 formulas as you did before if {job.phase} = "working1" then "X", one for each of the phases/workings. Drop all 5 of those formulas into the Details section of the report and then suppress that entire section so that it doesn't display.
To show the Xs, you can use a Maximum summary in the Group Footer for each of the five formulas you created. To do this, right-click each of the formulas in turn, select Insert -> Summary. Choose Maximum as the summary, and "Group 1" (Your job ID or whatever field you are using to group the job) as the Location. That will insert a field into the Group Footer that will display an X when that particular working is specified for the job, otherwise it won't display anything. Move them to display next to the appropriate label/text field and you're done.

Resources