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..?
 

Some videos you may like

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
Do you really need VBA here for the following with E2 = 225000...

=LOOKUP(E2,Tvalues,Dpercentages)

would be lightning fast?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,224
Messages
5,594,915
Members
413,952
Latest member
JGer

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
Top