Need recursive LAMBDA help please

greegan

Well-known Member
Joined
Nov 18, 2009
Messages
644
Office Version
  1. 365
Platform
  1. Windows
I am working on an Erlang C formula and was having trouble until I found out about LAMBDA functions. They are awesome!
My formula is currently calculating the Service Level of our contact centre with a specific number of agents. If the result does not meet the target (in this case 80%) we need to more agents until it reaches at least the target or better.
I only need help with this portion of the formula. I believe a recursive LAMBDA will work with this but I'm not comprehending the syntax. Major brain fart here. Here is what I'm thinking:

target = .8
sl = current service level = ?
n = number of agents already considered
Naming LAMBDA function SLT

=LAMBDA(sl,target,n,if(sl<target,SLT+1,0))

The issue I'm running into is that the Service Level already has a formula and will be a circular reference because it is dependent on the total of n.

I'm likely going to making the whole formula into a LAMBDA function if I can get help on the above step.

If you need more information, I can include all of the factors and functions used for the final numbers.

My formulas are based on the ErlangC formula from wikipedia

Erlang.jpg


And the explanation HERE


Thank you for your help.


-- g







If its not in my signature I'm using Office 365 for Windows 10.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In an earlier post, I presented one approach for this...although it doesn't use the LAMBDA function. Because it uses Excel's FACT function, there will be computational limits when N>=171...then other approaches are needed. In this post is a link to my file on Dropbox. In that Excel file on rows 24-26 you will see X term and Y term and Probability mentioned. Those refer to the X and Y terms on the web link in your post (at callcentrehelper)
 
Last edited:
Upvote 0
If its not in my signature I'm using Office 365 for Windows 10.

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Thank you. I wasn't sure where to look for the signature. It appears I had updated (which is current) my signature a while back.
 
Upvote 0
Can you please update your account details as requested (not you signature), as that is where most people look to see what version you are using. Thanks
 
Upvote 0
In an earlier post, I presented one approach for this...although it doesn't use the LAMBDA function. Because it uses Excel's FACT function, there will be computational limits when N>=171...then other approaches are needed. In this post is a link to my file on Dropbox. In that Excel file on rows 24-26 you will see X term and Y term and Probability mentioned. Those refer to the X and Y terms on the web link in your post (at callcentrehelper)
Thank you for your post. I am waiting for permission from my office to go beyond this forum (the dropbox) and will take a look when I can.
Really, the rest of the formula is done. I get the numbers they test on the CallCenterHelper website. Its only that I need to manually add more agents to N for the service level to increase.
This is where the recursive lambda would be helpful. As I understand it, it works like the function is a circular reference but returns an accurate result with no errors.
I'm looking for any help I can get with this.
 
Upvote 0
If access is a problem, the relevant portion of the file is:
ErlangC_20210313.xlsx
ABCDEFG
31. Inputs:
4Number of calls583volume49000num/wk
5In a period of minutes (min)60conv17day/wk
6Average Handling Time (AHT) (s)180conv212hr/day
7Required Service Level90%conv360min/hr
8Target Answer Time (s)432009.722222222num/min
9Maximum Occupancy80%time basis60min
10Shrinkage21%number of calls583.3333333num/time basis
11
122. Determine number of calls per hourresponse time12hr
13n_avg (# calls/h)583conv160min/hr
14conv260s/min
153. Determine the Traffic Intensity (A)(hour basis)target ans time43200sec
16# of calls in hour basis583
17Avg time per call (min)3
18Call-minutes per hour1749
19Traffic intensity (A) , call-hours per hour (Erlang unitless)29.15
20
214. Estimate the raw number of agents required (N)
22One agent max capability is 1 call-hour per hour actual time
23Initial guess for N agents required30.153032343638
24X term1.63863E+131.15664E+133.15186E+121.49033E+127.53468E+113.72036E+11
25Y term2457766582008.632457766582008.633093639949663.063622315635137.584011965941098.524268285119753.46
26Probability a call has to wait, Pw86.96%82.47%50.47%29.15%15.81%8.02%
27
285. Calculate the Service Level (list item #13 in ref)
29Service Level100.00%100.00%100.00%100.00%100.00%100.00%
30Target Service Level90%90%90%90%90%90%
31Target Service Level Met?TRUETRUETRUETRUETRUETRUE
ErlangC
Cell Formulas
RangeFormula
E8E8=E4/E5/E6/E7
E10,B18E10=E8*E9
B13B13=B4/(B5/60)
E15E15=E12*E13*E14
B16B16=B13
B17B17=B6/60
B19B19=B18/60
B23B23=B19+1
B24:G24B24=B$23/FACT(B$23)/(B$23-$B$19) * $B$19^B$23
B25:G25B25=IF(B$23<2, 1, 1 + SUMPRODUCT($B$19^ROW($A$1:INDEX($A:$A, B$23-1)) / FACT(ROW($A$1:INDEX($A:$A, B$23-1)))))
B26:G26B26=B24/(B24+B25)
B29:G29B29=1-B26*EXP(-(B23-$B$19)*($B$8/$B$6))
B30:G30B30=$B$7
B31:G31B31=B29>=B30
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B31:G31Cell Value=TRUEtextNO

...where the probability formula is simplified into X and Y terms referenced in the worksheet (lines 24 and 25, the factorials and summations are handled by the single-line formulas):
1649866366758.png
 
Upvote 0
Thank you for the posted file information. But I think the point is being missed.
I have everything but N. N is the variable when Service Level doesn't reach 80%. When it doesn't meet that minimum of 80% N needs to be calculated again. I want N to calculate automatically when SL<.8 so it adds a 1, recalculates, and then determines if it meets the criteria and adds another 1 if it doesn't meet that 80%.
My formula works fine, and I can enter increased amounts of the value of N until I reach the optimum Service Level, but I forecast on 15-minute intervals for three weeks at a time, so that would be many manual adjustments of N I should be able to avoid with a recursive LAMBDA function because what I've described above will be a circular reference otherwise.
 
Upvote 0
The value of Y, for example is a LAMBDA function I was able to create.
Excel Formula:
=LAMBDA(a,i,ROUND(SERIESSUM(a,0,1,1/(FACT(SEQUENCE(i+1,,0)))),1))
Add this to the name manager and name it Series_Y
Then for the value of Y the formula is simply
Excel Formula:
=Series_Y(Erlangs,N-1)

Excel Formula:
=1-(Pw*POWER(e,((N-Erlangs)*([Target ASA/Target AHT))))
And the above is my Service Level formula. But again if it doesn't reach 80%, we need to add 1 to N, and like I said its a circular reference that, I believe, a recursive LAMBDA function would resolve.
Maybe the whole thing needs to be recursive to function right.

-- g
 
Upvote 0
I see...yes, the sheet I posted requires some user intervention for the N variable. The user inputs guesses for N to bound the problem and then fine tunes the guesses to zero in on the minimum N to satisfy conditions.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top