• Hi,

    I’m setting up this plugin for use as a quotation form on a proofreading website, and am really happy with the functionality and versatility. One difficulty I am having though is with setting dynamic pricing using nested IFs with 2 rules.

    The two values I want to create rules for are wordcount (1-100,000) and completion times (10 days, 7 days, 4 days, 2 days, 1 day, 12 hours), because as the wordcount increases, the relationship between it and standard/express delivery changes e.g. standard completion for up to 5000 words would be 2 days, but for 25000 words would be 4 days, etc.

    I have given values to the completion times as follows:

    10 days = 0.991
    7 days = 0.992
    4 days = 0.993
    2 days = 1
    1 day = 1.5
    12 hours = 2

    The current output code is:

    (type_of_proofreading * formatting * wordcount * completion_times * discounts)

    This is the formula with the 2 rules for each line I would like to incorporate into IF statements (note that the higher wordcount values*0 = not possible in this short completion time):

    if wordcount<5000 AND completion_times 0.991 THEN wordcount*0.85
    if wordcount<5000 AND completion_times 0.992 THEN wordcount*0.9
    if wordcount<5000 AND completion_times 0.993 THEN wordcount*0.95
    if wordcount<5000 AND completion_times 1 THEN wordcount*1
    if wordcount<5000 AND completion_times 1.5 THEN wordcount*1.5
    if wordcount<5000 AND completion_times 2 THEN wordcount*2

    if wordcount>5001 BUT <10000 AND completion_times 0.991 THEN wordcount*0.85
    if wordcount>5001 BUT <10000 AND completion_times 0.992 THEN wordcount*0.9
    if wordcount>5001 BUT <10000 AND completion_times 0.993 THEN wordcount*1
    if wordcount>5001 BUT <10000 AND completion_times 1 THEN wordcount*1.5
    if wordcount>5001 BUT <10000 AND completion_times 1.5 THEN wordcount*2
    if wordcount>5001 BUT <10000 AND completion_times 2 THEN wordcount*0

    if wordcount>10001 BUT <25000 AND completion_times 0.991 THEN wordcount*0.85
    if wordcount>10001 BUT <25000 AND completion_times 0.992 THEN wordcount*0.9
    if wordcount>10001 BUT <25000 AND completion_times 0.993 THEN wordcount*1
    if wordcount>10001 BUT <25000 AND completion_times 1 THEN wordcount*1.5
    if wordcount>10001 BUT <25000 AND completion_times 1.5 THEN wordcount*0
    if wordcount>10001 BUT <25000 AND completion_times 2 THEN wordcount*0

    if wordcount>25001 AND completion_times 0.991 THEN wordcount*0.85
    if wordcount>25001 AND completion_times 0.992 THEN wordcount*1
    if wordcount>25001 AND completion_times 0.993 THEN wordcount*1.5
    if wordcount>25001 AND completion_times 1 THEN wordcount*0
    if wordcount>25001 AND completion_times 1.5 THEN wordcount*0
    if wordcount>25001 AND completion_times 2 THEN wordcount*0

    I’ve been racking my brains to think of another way to resolve this by using the existing features of the plugin, but keep drawing a blank. Could this type of dynamic pricing be achieved without modifying the plugin?

    Thanks,
    Barnez

    https://www.ads-software.com/plugins/jazzy-forms/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter barnez

    (@pidengmor)

    Now I have the formula for the wordcount vs completion times:

    =IF(AND(wordcount<=5000,Completion_times=0.991)=TRUE,wordcount*0.85,IF(AND(wordcount<=5000,Completion_times=0.992)=TRUE,wordcount*0.9,IF(AND(wordcount<=5000,Completion_times=0.993)=TRUE,wordcount*0.95,IF(AND(wordcount<=5000,Completion_times=1)=TRUE,wordcount*1,IF(AND(wordcount<=5000,Completion_times=1.5)=TRUE,wordcount*1.5,IF(AND(wordcount<=5000,Completion_times=2)=TRUE,wordcount*2,IF(AND(wordcount>5000,wordcount<=10000,Completion_times=0.991)=TRUE,wordcount*0.85,IF(AND(wordcount>5000,wordcount<=10000,Completion_times=0.992)=TRUE,wordcount*0.9,IF(AND(wordcount>5000,wordcount<=10000,Completion_times=0.993)=TRUE,wordcount*1,IF(AND(wordcount>5000,wordcount<=10000,Completion_times=1)=TRUE,wordcount*1.5,IF(AND(wordcount>5000,wordcount<=10000,Completion_times=1.5)=TRUE,wordcount*2,IF(AND(wordcount>5000,wordcount<=10000,Completion_times=2)=TRUE,wordcount*0,IF(AND(wordcount>10000,wordcount<=25000,Completion_times=0.991)=TRUE,wordcount*0.85,IF(AND(wordcount>10000,wordcount<=25000,Completion_times=0.992)=TRUE,wordcount*0.9,IF(AND(wordcount>10000,wordcount<=25000,Completion_times=0.993)=TRUE,wordcount*1,IF(AND(wordcount>10000,wordcount<=25000,Completion_times=1)=TRUE,wordcount*0,IF(AND(wordcount>10000,wordcount<=25000,Completion_times=1.5)=TRUE,wordcount*0,IF(AND(wordcount>10000,wordcount<=25000,Completion_times=2)=TRUE,wordcount*0,IF(AND(wordcount>25000,Completion_times=0.991)=TRUE,wordcount*0.85,IF(AND(wordcount>25000,Completion_times=0.992)=TRUE,wordcount*1,IF(AND(wordcount>25000,Completion_times=0.993)=TRUE,wordcount*1.5,IF(AND(wordcount>25000,Completion_times=1)=TRUE,wordcount*0,IF(AND(wordcount>25000,Completion_times=1.5)=TRUE,wordcount*0,IF(AND(wordcount>25000,Completion_times=2)=TRUE,wordcount*0,""))))))))))))))))))))))))

    The question is, how to insert this into the original output formula of
    (type_of_proofreading * formatting * wordcount * completion_times * discounts)
    by replacing wordcount*completion_times?

    Thread Starter barnez

    (@pidengmor)

    I’m now very close with the nested IF statements. If you visit https://www.englishlc.com/lucky-man/ and use the password “luckyman” you can see that the form is calculating.

    The code now looks like this:

    (type_of_proofreading*formatting*wordcount*(IF(AND(wordcount<5000,completion_times=0.992),0.9,IF(AND(wordcount<5000,completion_times=0.993),0.95,IF(AND(wordcount<5000,completion_times=1),1,IF(AND(wordcount<5000,completion_times=1.5),1.5,IF(AND(wordcount<5000,completion_times=2),2,.......IF(AND(wordcount>25001,completion_times=2),0,"")))))))))))))))))))))*discounts)

    However I am having some problems with the >25001 wordcounts vs completion times giving a value or 1, 1.5 or 2 instead of 0 (i.e. not available). The problems while not critical, are annoying. I have checked using the >25001 range on its own and it works fine, but with all the other ranges it doesn’t give the same outputs. Is this an issue with long nested IF(AND statements and/or the limitations of the plugin? Or can the parenthesis be strengthened to stop overflow into other later IF(AND statements ?

    Any suggestions would be gratefully received.
    Cheers,

    Thread Starter barnez

    (@pidengmor)

    The final form in action can now be seen here: https://www.englishlc.com/how-to-pay/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Dynamic pricing: If statement with 2 rules’ is closed to new replies.