Forum Discussion
Ricky Blackwell
May 28, 2018Copper Contributor
Help with a Formula please
Hi, Here is how the sheet looks so far Dip Sampling Rejected Dip Sample Cleansed Dip Sample Total Success Rate To Success Rate Target 1 4 5 80.00% 96% 0 0 0 ...
Matt Mickle
May 28, 2018Bronze Contributor
Maybe try using the User Defined Function (UDF) below:
Function GetCleansed(Cleansed As Integer, Total As Integer, PercentTarget As Double)
Dim x As Integer
For x = 1 To 10000
If Cleansed / Total >= PercentTarget Then
GetCleansed = "Target Met"
Exit Function
ElseIf (Cleansed + x) / (Total + x) > PercentTarget Then
GetCleansed = Cleansed + x
Exit Function
End If
Next x
GetCleansed = "Large Number...."
End Function
If you're unfamiliar with UDFs then please take a look at this link for some additional information:
https://www.vertex42.com/blog/excel-formulas/custom-user-defined-functions.html