How to find discount-% from target table?

kingtoni

New Member
Joined
Oct 11, 2006
Messages
25
What is the easiest way to find out how much I'll get discount:

Target value and Discount-%
50 000 0,50 %
100 000 1,00 %
150 000 1,50 %
200 000 2,00 %
250 000 2,50 %
300 000 3,00 %
350 000 3,50 %
400 000 4,00 %
450 000 4,50 %
500 000 5,00 %

My actual value is 225 000 and table above shows that I'll get 2,00% discount.

I tried to create function as below. It only shows which row you'll find your discount, not the actual percentage.


Public Function FindDiscount(ActualValue As Long, TargetValues As Range) As Long

Dim discount As Long

For Each TargetValues In Selection
If TargetValues <= ActualValue Then
discount = discount + 1
End If
Next

FindDiscount = discount

End Function


In function window my function show the correct row number but when I continue I'll get an error message about circular reference. Any idea..?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Do you really need VBA here for the following with E2 = 225000...

=LOOKUP(E2,Tvalues,Dpercentages)

would be lightning fast?
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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