If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Formula Question
I have the following formula on one worksheet 240 times. Of course the
formula is a bit different but the length is pretty much the same. Is there an easier way to speed up the calculating process of this worksheet? Can this type of formual be put in VB code behind the worksheet and will that make it compute faster? Not really sure if any of this is possible but I figured I'd ask. Just looking to speed up the calculations. =IF($B$3="All",IF($I$3="W/ BLANKET ORDERS",SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$B$2:$B$49706"All")),SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$L$2:$L$49706="F"),--(Detail!$B$2:$B$49706"All"))),IF($I$3="W/ BLANKET ORDERS",SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$B$2:$B$49706=LeadTimes!$B$3)),SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$L$2:$L$49706="F"),--(Detail!$B$2:$B$49706=LeadTimes!$B$3)))) |
#2
|
|||
|
|||
Formula Question
I noticed that there is a lot of redundancy in your Sumproduct agruments. Try
this experimentally in place of your formula. It's a bit of a wild shot since I can't test it. Commit with Ctrl + Shift + Enter: =SUM((MONTH(Detail!$J$2:$J$49706)=MONTH(B15))*(YEA R(Detail!$J$2:$J$49706)=YEAR(B15))*(Detail!$N$2:$N $49706=1)*(Detail!$Q$2:$Q$49706=0)*IF($B$3="All", (Detail!$B$2:$B$49706"All")*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$49706="F"),(Detail!$B$2:$ B$49706=LeadTimes!$B$3)*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$49706="F"))) Greg "Secret Squirrel" wrote: I have the following formula on one worksheet 240 times. Of course the formula is a bit different but the length is pretty much the same. Is there an easier way to speed up the calculating process of this worksheet? Can this type of formual be put in VB code behind the worksheet and will that make it compute faster? Not really sure if any of this is possible but I figured I'd ask. Just looking to speed up the calculations. =IF($B$3="All",IF($I$3="W/ BLANKET ORDERS",SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$B$2:$B$49706"All")),SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$L$2:$L$49706="F"),--(Detail!$B$2:$B$49706"All"))),IF($I$3="W/ BLANKET ORDERS",SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$B$2:$B$49706=LeadTimes!$B$3)),SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$L$2:$L$49706="F"),--(Detail!$B$2:$B$49706=LeadTimes!$B$3)))) |
#3
|
|||
|
|||
Formula Question
Thanks for your help Greg. It works fine that way. Question though....if I go
ahead and change all my formulas to this way will it speed up the calculations since the formula is now shorter? "Greg Wilson" wrote: I noticed that there is a lot of redundancy in your Sumproduct agruments. Try this experimentally in place of your formula. It's a bit of a wild shot since I can't test it. Commit with Ctrl + Shift + Enter: =SUM((MONTH(Detail!$J$2:$J$49706)=MONTH(B15))*(YEA R(Detail!$J$2:$J$49706)=YEAR(B15))*(Detail!$N$2:$N $49706=1)*(Detail!$Q$2:$Q$49706=0)*IF($B$3="All", (Detail!$B$2:$B$49706"All")*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$49706="F"),(Detail!$B$2:$ B$49706=LeadTimes!$B$3)*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$49706="F"))) Greg "Secret Squirrel" wrote: I have the following formula on one worksheet 240 times. Of course the formula is a bit different but the length is pretty much the same. Is there an easier way to speed up the calculating process of this worksheet? Can this type of formual be put in VB code behind the worksheet and will that make it compute faster? Not really sure if any of this is possible but I figured I'd ask. Just looking to speed up the calculations. =IF($B$3="All",IF($I$3="W/ BLANKET ORDERS",SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$B$2:$B$49706"All")),SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$L$2:$L$49706="F"),--(Detail!$B$2:$B$49706"All"))),IF($I$3="W/ BLANKET ORDERS",SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$B$2:$B$49706=LeadTimes!$B$3)),SUMPRODUCT(--(MONTH(Detail!$J$2:$J$49706)=MONTH(B15)),--(YEAR(Detail!$J$2:$J$49706)=YEAR(B15)),--(Detail!$N$2:$N$49706=1),--(Detail!$Q$2:$Q$49706=0),--(Detail!$L$2:$L$49706="F"),--(Detail!$B$2:$B$49706=LeadTimes!$B$3)))) |
#4
|
|||
|
|||
Formula Question
I'm not a worksheet formula expert. So test my formula rigorously. I only
gave it a cursory test under highly simplified conditions. To compare the two formulae: 1. First make a copy of your wb. 2. In the new wb, insert a copy of your formula. 3. Drag the formula down so that it autofills hundreds of rows. 4. Change the value of a cell referenced by the formula so that it must recalculate and see how it performs. 5. Clear the range of formulae created in step 3 and repeat steps 2 to 4 using my formula instead. FYI, your formula is in the form of: =IF(Cond1, IF(Cond2, SP1(), SP2()), IF(Cond2, SP3(), SP4())) whe SP1() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(EEE)) SP2() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(EEE)) SP3() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(GGG)) SP4() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(GGG)) whe (AAA), (BBB) etc. are abbreviations for the Sumproduct arguments. You have only 7 different Sumproduct arguments, (AAA) to (GGG). But these arguments are listed 22 times in the formula *and therefore evaluated 22 times* because of the repetition. My formula is an array formula (Ctrl + Shift + Enter) in the form of: =SUM((AAA)*(BBB)*(CCC)*(DDD)*IF(Cond1, (EEE)*IF(Cond2,1,(FFF)),(GGG)*IF(Cond2,1,(FFF)))) You can see that only argument (FFF) is evaluated more than once. Greg |
#5
|
|||
|
|||
Formula Question
I understand now. Thanks for the explanation. I went through and changed all
my formulas to mirror yours and it does calculate much faster. I tested it based on the time it took mine to calculate. It went from 20 seconds down to 3 seconds. That's a very drastic change in calculation time. I have just one follow up question. I need to add another piece to this formula now. Where I was calling out cell B3 I now need to do the same for cell J3. How would I add that to the formula you wrote? =SUM((MONTH(Detail!$J$2:$J$12000)=MONTH(B15))*(YEA R(Detail!$J$2:$J$12000)=YEAR(B15))*(Detail!$N$2:$N $12000=1)*(Detail!$Q$2:$Q$12000=0)*IF($B$3="All", (Detail!$B$2:$B$12000"All")*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"),(Detail!$B$2:$ B$12000=LeadTimes!$B$3)*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"))) I appreciate all your help here. "Greg Wilson" wrote: I'm not a worksheet formula expert. So test my formula rigorously. I only gave it a cursory test under highly simplified conditions. To compare the two formulae: 1. First make a copy of your wb. 2. In the new wb, insert a copy of your formula. 3. Drag the formula down so that it autofills hundreds of rows. 4. Change the value of a cell referenced by the formula so that it must recalculate and see how it performs. 5. Clear the range of formulae created in step 3 and repeat steps 2 to 4 using my formula instead. FYI, your formula is in the form of: =IF(Cond1, IF(Cond2, SP1(), SP2()), IF(Cond2, SP3(), SP4())) whe SP1() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(EEE)) SP2() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(EEE)) SP3() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(GGG)) SP4() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(GGG)) whe (AAA), (BBB) etc. are abbreviations for the Sumproduct arguments. You have only 7 different Sumproduct arguments, (AAA) to (GGG). But these arguments are listed 22 times in the formula *and therefore evaluated 22 times* because of the repetition. My formula is an array formula (Ctrl + Shift + Enter) in the form of: =SUM((AAA)*(BBB)*(CCC)*(DDD)*IF(Cond1, (EEE)*IF(Cond2,1,(FFF)),(GGG)*IF(Cond2,1,(FFF)))) You can see that only argument (FFF) is evaluated more than once. Greg |
#6
|
|||
|
|||
Formula Question
The formula structure is here repeated. Cell B3 is referenced in Cond1:
=SUM((AAA)*(BBB)*(CCC)*(DDD)*IF(Cond1,(EEE)*IF(Con d2,1,(FFF)),(GGG)*IF(Cond2,1,(FFF)))) It depends on what you mean by "do the same for J3". I assume you don't mean just change the reference from B3 to J3 because that's too simple. I assume you want to change the structure to include another condition, i.e. where J3 = whatever. You need to specify what you want to happen when the new condition is True/False. Greg "Secret Squirrel" wrote: I understand now. Thanks for the explanation. I went through and changed all my formulas to mirror yours and it does calculate much faster. I tested it based on the time it took mine to calculate. It went from 20 seconds down to 3 seconds. That's a very drastic change in calculation time. I have just one follow up question. I need to add another piece to this formula now. Where I was calling out cell B3 I now need to do the same for cell J3. How would I add that to the formula you wrote? =SUM((MONTH(Detail!$J$2:$J$12000)=MONTH(B15))*(YEA R(Detail!$J$2:$J$12000)=YEAR(B15))*(Detail!$N$2:$N $12000=1)*(Detail!$Q$2:$Q$12000=0)*IF($B$3="All", (Detail!$B$2:$B$12000"All")*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"),(Detail!$B$2:$ B$12000=LeadTimes!$B$3)*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"))) I appreciate all your help here. "Greg Wilson" wrote: I'm not a worksheet formula expert. So test my formula rigorously. I only gave it a cursory test under highly simplified conditions. To compare the two formulae: 1. First make a copy of your wb. 2. In the new wb, insert a copy of your formula. 3. Drag the formula down so that it autofills hundreds of rows. 4. Change the value of a cell referenced by the formula so that it must recalculate and see how it performs. 5. Clear the range of formulae created in step 3 and repeat steps 2 to 4 using my formula instead. FYI, your formula is in the form of: =IF(Cond1, IF(Cond2, SP1(), SP2()), IF(Cond2, SP3(), SP4())) whe SP1() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(EEE)) SP2() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(EEE)) SP3() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(GGG)) SP4() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(GGG)) whe (AAA), (BBB) etc. are abbreviations for the Sumproduct arguments. You have only 7 different Sumproduct arguments, (AAA) to (GGG). But these arguments are listed 22 times in the formula *and therefore evaluated 22 times* because of the repetition. My formula is an array formula (Ctrl + Shift + Enter) in the form of: =SUM((AAA)*(BBB)*(CCC)*(DDD)*IF(Cond1, (EEE)*IF(Cond2,1,(FFF)),(GGG)*IF(Cond2,1,(FFF)))) You can see that only argument (FFF) is evaluated more than once. Greg |
#7
|
|||
|
|||
Formula Question
Your assumption is correct. I want to add another condition just like the one
in B3. If(J3= "All",(Detail!$T$2:$T$12000"All") (Detail!$T$2:$T$12000=LeadTimes!$J$3) Above are the same conditions I have for B3 so I want to duplicate them as another condition. Where would I add these parts to the formula? It's just another way for me to filter my data when selections are made in either B3, J3, and I3. "Greg Wilson" wrote: The formula structure is here repeated. Cell B3 is referenced in Cond1: =SUM((AAA)*(BBB)*(CCC)*(DDD)*IF(Cond1,(EEE)*IF(Con d2,1,(FFF)),(GGG)*IF(Cond2,1,(FFF)))) It depends on what you mean by "do the same for J3". I assume you don't mean just change the reference from B3 to J3 because that's too simple. I assume you want to change the structure to include another condition, i.e. where J3 = whatever. You need to specify what you want to happen when the new condition is True/False. Greg "Secret Squirrel" wrote: I understand now. Thanks for the explanation. I went through and changed all my formulas to mirror yours and it does calculate much faster. I tested it based on the time it took mine to calculate. It went from 20 seconds down to 3 seconds. That's a very drastic change in calculation time. I have just one follow up question. I need to add another piece to this formula now. Where I was calling out cell B3 I now need to do the same for cell J3. How would I add that to the formula you wrote? =SUM((MONTH(Detail!$J$2:$J$12000)=MONTH(B15))*(YEA R(Detail!$J$2:$J$12000)=YEAR(B15))*(Detail!$N$2:$N $12000=1)*(Detail!$Q$2:$Q$12000=0)*IF($B$3="All", (Detail!$B$2:$B$12000"All")*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"),(Detail!$B$2:$ B$12000=LeadTimes!$B$3)*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"))) I appreciate all your help here. "Greg Wilson" wrote: I'm not a worksheet formula expert. So test my formula rigorously. I only gave it a cursory test under highly simplified conditions. To compare the two formulae: 1. First make a copy of your wb. 2. In the new wb, insert a copy of your formula. 3. Drag the formula down so that it autofills hundreds of rows. 4. Change the value of a cell referenced by the formula so that it must recalculate and see how it performs. 5. Clear the range of formulae created in step 3 and repeat steps 2 to 4 using my formula instead. FYI, your formula is in the form of: =IF(Cond1, IF(Cond2, SP1(), SP2()), IF(Cond2, SP3(), SP4())) whe SP1() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(EEE)) SP2() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(EEE)) SP3() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(GGG)) SP4() = Sumproduct(--(AAA),--(BBB),--(CCC),--(DDD),--(FFF),--(GGG)) whe (AAA), (BBB) etc. are abbreviations for the Sumproduct arguments. You have only 7 different Sumproduct arguments, (AAA) to (GGG). But these arguments are listed 22 times in the formula *and therefore evaluated 22 times* because of the repetition. My formula is an array formula (Ctrl + Shift + Enter) in the form of: =SUM((AAA)*(BBB)*(CCC)*(DDD)*IF(Cond1, (EEE)*IF(Cond2,1,(FFF)),(GGG)*IF(Cond2,1,(FFF)))) You can see that only argument (FFF) is evaluated more than once. Greg |
#8
|
|||
|
|||
Formula Question
Looking at your original formula which is more intuitive:
=IF(Cond1, IF(Cond2, SP1(), SP2()), IF(Cond2, SP3(), SP4())) Translation: If Cond1 = True and Cond2 = True then evaluate SP1() If Cond1 = True and Cond2 = False then evaluate SP2() If Cond1 = False and Cond2 = True then evaluate SP3() If Cond1 = False and Cond2 = False then evaluate SP4() The IF function referencing Cond1 has two branches. For each branch, the IF function referencing Cond2 has two branches. Total: four Sumproduct options. I'm still confused as to how you want to include the new condition (call it Cond3). Is Cond2 child to Cond3 or vice versa or neither? 1. Please specify the logic structure as per the format I used above for your original formula. 2. Call the new condition Cond3. 3. Call new Sumproduct options SP5() and SP6(). 4. Specify the arguments of SP5() and SP6(). You can use abbreviations (AAA) to (DDD). Beyond that you should probably spell them out to avoid confusion. If you intend others to use your project, 20 seconds response time is basically dysfunctional while 3 seconds is klunky. Adding another condition will make it worse. Are you sure you want to do this? Depending on how your worksheet is structured, one thought is that it may be feasible to have a subset (say a table of interest) update at a time, where the user clicks a "Calculate" button. The actual performance won't be improved since the user has to respond, but the optics may be improved. This can be managed with VBA. Be advised that I have to go out for several hours and can't check your response until this evening. Greg |
#9
|
|||
|
|||
Formula Question
I tried to walk through this as easily as possible using my old formula. I
tried spelling out all the conditions so we're both on the same page. I understand what you're saying and I used my original formula to walk through each condition. See Below: If B3 = “All” And I3 = “W/ Blanket Orders” And M3 = “All” is True the return all rows If B3”All” And I3 = “W/ Blanket Orders” And M3 = “All” is True then return all rows where B3 equals Column B on Details tab If B3=”All” And I3 = “W/ Blanket Orders” And M3”All” is True then return all rows where M3 equals Column M on Details tab If B3”All” And I3 = “W/ Blanket Orders” And M3”All” is True then return all rows where B3 equals Column B on Details tab And then return all rows where M3 equals Column M on Details tab Example: If B3 = “My Company” then give me all rows where “My Company” is in Column B and then find within the “My Company” rows any rows that M3 equals column M If B3=”All” And I3 “W/ Blanket Orders” And M3=”All” is True then return all rows where Column L equals “F” If B3”All” And I3 “W/ Blanket Orders” And M3=”All” is True then return all rows where B3 equals Column B on Details tab And where Column L equals “F” If B3=”All” And I3 “W/ Blanket Orders” And M3”All” is True then return all rows where Column L equals “F” on Details tab And where M3 equals Column M on Details tab If B3=”All” And I3 “W/ Blanket Orders” And M3”All” is True then return all rows where B3 equals Column B on Details tab And where Column L equals “F” And where M3 equals Column M on Details tab The above are all using the 3rd condition. I think I covered them all. Review it when you have a chance and let me know what you think. If it makes it easier for you I can send you my file so you can see what I'm trying to do. Thanks Greg! "Greg Wilson" wrote: Looking at your original formula which is more intuitive: =IF(Cond1, IF(Cond2, SP1(), SP2()), IF(Cond2, SP3(), SP4())) Translation: If Cond1 = True and Cond2 = True then evaluate SP1() If Cond1 = True and Cond2 = False then evaluate SP2() If Cond1 = False and Cond2 = True then evaluate SP3() If Cond1 = False and Cond2 = False then evaluate SP4() The IF function referencing Cond1 has two branches. For each branch, the IF function referencing Cond2 has two branches. Total: four Sumproduct options. I'm still confused as to how you want to include the new condition (call it Cond3). Is Cond2 child to Cond3 or vice versa or neither? 1. Please specify the logic structure as per the format I used above for your original formula. 2. Call the new condition Cond3. 3. Call new Sumproduct options SP5() and SP6(). 4. Specify the arguments of SP5() and SP6(). You can use abbreviations (AAA) to (DDD). Beyond that you should probably spell them out to avoid confusion. If you intend others to use your project, 20 seconds response time is basically dysfunctional while 3 seconds is klunky. Adding another condition will make it worse. Are you sure you want to do this? Depending on how your worksheet is structured, one thought is that it may be feasible to have a subset (say a table of interest) update at a time, where the user clicks a "Calculate" button. The actual performance won't be improved since the user has to respond, but the optics may be improved. This can be managed with VBA. Be advised that I have to go out for several hours and can't check your response until this evening. Greg |
#10
|
|||
|
|||
Formula Question
Hi Greg,
After playing with this formula for a bit I have most of it figured out with the third condition in it. The only problem is when B3 does not equal "All" and I3 equals "W/ Blanket Orders" and M3 equals "All", I don't get the correct result. I must be missing one part of the formula. Any chance you know where I went wrong? =SUM((MONTH(Detail!$J$2:$J$12000)=MONTH(B15))*(YEA R(Detail!$J$2:$J$12000)=YEAR(B15))*(Detail!$N$2:$N $12000=1)*(Detail!$Q$2:$Q$12000=0)*IF($M$3="All", (Detail!$M$2:$M$12000"All")*(Detail!$B$2:$B$1200 0"All")*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"),(Detail!$M$2:$ M$12000=LeadTimes!$M$3)*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F")*IF($B$3="All", (Detail!$B$2:$B$12000"All")*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F"),(Detail!$B$2:$ B$12000=LeadTimes!$B$3)*IF($I$3="W/ BLANKET ORDERS",1,Detail!$L$2:$L$12000="F")))) "Greg Wilson" wrote: Looking at your original formula which is more intuitive: =IF(Cond1, IF(Cond2, SP1(), SP2()), IF(Cond2, SP3(), SP4())) Translation: If Cond1 = True and Cond2 = True then evaluate SP1() If Cond1 = True and Cond2 = False then evaluate SP2() If Cond1 = False and Cond2 = True then evaluate SP3() If Cond1 = False and Cond2 = False then evaluate SP4() The IF function referencing Cond1 has two branches. For each branch, the IF function referencing Cond2 has two branches. Total: four Sumproduct options. I'm still confused as to how you want to include the new condition (call it Cond3). Is Cond2 child to Cond3 or vice versa or neither? 1. Please specify the logic structure as per the format I used above for your original formula. 2. Call the new condition Cond3. 3. Call new Sumproduct options SP5() and SP6(). 4. Specify the arguments of SP5() and SP6(). You can use abbreviations (AAA) to (DDD). Beyond that you should probably spell them out to avoid confusion. If you intend others to use your project, 20 seconds response time is basically dysfunctional while 3 seconds is klunky. Adding another condition will make it worse. Are you sure you want to do this? Depending on how your worksheet is structured, one thought is that it may be feasible to have a subset (say a table of interest) update at a time, where the user clicks a "Calculate" button. The actual performance won't be improved since the user has to respond, but the optics may be improved. This can be managed with VBA. Be advised that I have to go out for several hours and can't check your response until this evening. Greg |
|
Thread Tools | |
Display Modes | |
|
|