
1. Re: Formula for if and then statements
try67 Feb 5, 2015 5:26 AM (in response to gc21244600)Custom calculation script for "c":
var a = this.getField("a").valueAsString; var b = this.getField("b").valueAsString; if (a==""  b=="") event.value = ""; else { a = Number(a); b = Number(b); event.value = (a>b) ? 0 : a; }
I don't really understand what the calculation for "d" should be...
Edit: fixed code..

2. Re: Formula for if and then statements
gc21244600 Feb 5, 2015 8:07 AM (in response to try67)try67  Thank you sooooooo very much for uour kind help! It seems we're 95% there!!! The fotmula worked perfectly for half of it but not the other half.
example:
box a gave me a value of 66 as a result of box 1 and box 2 (assumed)
box b is fixed at 100
box c did take box a since it is less than box b however what I need is when you subtract b from a and it gives you a minus number to take what's in box b.
so let's say I have 200 in box a and 100 in box b, then the answer would be 100... so instead of even putting zero I want it to just take the amount in box b, I hope that makes sense and sorry for mumbling, I've been awake for over 24 hours and I'm not even 1% as smart as some people here. I am so very grateful for your assistance!

3. Re: Formula for if and then statements
try67 Feb 5, 2015 9:00 AM (in response to gc21244600)Make sure you use the latest version of the code. I had changed it once or
twice already...

4. Re: Formula for if and then statements
gc21244600 Feb 5, 2015 10:14 AM (in response to try67)i did, I have adobe acrobat 9. the formula worked perfect for the less option but I will double check once I get home, Im sure I'm wrong.
i wonder if the first equation is messing things up. Thanks for all your help!

5. Re: Formula for if and then statements
gc21244600 Feb 5, 2015 1:43 PM (in response to gc21244600)Hello try67:
it seems I tried your formula and maybe it's acrobat 9 that doesn't accept the code.
Im doing the following:
boxes are as follow (and I just edited the names of the boxes correctly)...
a + b = c (the sum of box c will always be a positive number from box a + b unless if subtracted from box d makes it a negative number)
dc = e
box d will always have a value of 100... 140 to be exact.
box c is the result of box a + b
if box d is more than box c then box c's sum will be the number used unless it is a negative number in which case box d's amount will be used.
on your formula I get the lesser sum... in my example is 66 which is less than 140 however when the number goes into being negative or higher than 140 it won't auto populate 140 in the field. Trust me when I say that I know this sounds retarded... granted I didn't come up with the formula, it's just how it is being requested. I guess logic goes out the window here but I figured maybe, just maybe there's some sort of method of achieving that craziness. Thank you in advance for your patience and assistance!

6. Re: Formula for if and then statements
try67 Feb 5, 2015 1:45 PM (in response to gc21244600)Can you share the file in question, via Google Drive, Acrobat.com, Dropbox,
or by email?
On Thu, Feb 5, 2015 at 10:43 PM, gc21244600 <forums_noreply@adobe.com>

7. Re: Formula for if and then statements
gc21244600 Feb 5, 2015 2:00 PM (in response to try67)yes, can I email you? I've never done this. I will be able to do it in 5 hours from now. Sorry, I stepped away and no rush needed and again, all your help is appreciated!!!

8. Re: Formula for if and then statements
try67 Feb 5, 2015 2:29 PM (in response to gc21244600)Yeah, I'll send you my address via PM.