Help with a vlookup formula

silk

New Member
Joined
Sep 2, 2010
Messages
11
I need to produce a template based on someone else’s instructions and I’m really unsure about how to do this.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
What I need to do is make a template that has a VLOOKUP table for a discount on fees. The discount is offered on no. of days paid in advance.<o:p></o:p>
With the VLOOKUP table I’ll need two columns. One is a no of days range eg - :<o:p></o:p>
0-7<o:p></o:p>
8-14<o:p></o:p>
<o:p></o:p>
The second column will be a percentage discount. eg - :<o:p></o:p>
5%<o:p></o:p>
7%<o:p></o:p>
<o:p></o:p>I’ll need a correct formula for Days in Advance<o:p></o:p>
A correct formula for Discount<o:p></o:p>
And a correct. formula for Fees Paid<o:p></o:p>
<o:p></o:p>I am a real novice with Excel.<o:p> </o:p>Could someone please help.<o:p></o:p>
<o:p></o:p>I think I've attached what I’ve done so far, based on the information I had I’ve simply entered the columns and data and added the two extra columns, the Days difference and so far empty Fee paid ones<o:p></o:p>
I only want to do it the way I’ve mentioned. <o:p></o:p>I hop the mess below means I've attached a copy of it. attached a copy of it
<o:p></o:p>
thanks

<o:p>Sheet1

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Calibri,Arial; FONT-SIZE: 11pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 124px"><COL style="WIDTH: 103px"><COL style="WIDTH: 173px"><COL style="WIDTH: 145px"><COL style="WIDTH: 131px"><COL style="WIDTH: 131px"><COL style="WIDTH: 96px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt; FONT-WEIGHT: bold"><TD> </TD><TD>A</TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">1</TD><TD style="TEXT-ALIGN: center; FONT-WEIGHT: bold">Resort</TD><TD style="TEXT-ALIGN: center; FONT-WEIGHT: bold">Name</TD><TD style="TEXT-ALIGN: center; FONT-WEIGHT: bold">Commencement Date</TD><TD style="TEXT-ALIGN: center; FONT-WEIGHT: bold">Date Paid</TD><TD style="TEXT-ALIGN: center; FONT-WEIGHT: bold">No. Days Difference</TD><TD style="TEXT-ALIGN: center; FONT-WEIGHT: bold">Normal Fee</TD><TD style="FONT-WEIGHT: bold">Fee Paid</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">2</TD><TD style="TEXT-ALIGN: left">Tweed Heads</TD><TD>B & A Kelleher</TD><TD style="TEXT-ALIGN: right">09-Sep</TD><TD style="TEXT-ALIGN: right">01-Sep</TD><TD style="TEXT-ALIGN: right">8</TD><TD style="TEXT-ALIGN: right">$395.00</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">3</TD><TD style="TEXT-ALIGN: left">Daylseford</TD><TD>WG King</TD><TD style="TEXT-ALIGN: right">12-Sep</TD><TD style="TEXT-ALIGN: right">11-Sep</TD><TD> </TD><TD style="TEXT-ALIGN: right">$250.00</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">4</TD><TD style="TEXT-ALIGN: left">Surfers Paradise</TD><TD>R & G Smith</TD><TD style="TEXT-ALIGN: right">15-Sep</TD><TD style="TEXT-ALIGN: right">31-Aug</TD><TD> </TD><TD style="TEXT-ALIGN: right">$300.00</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">5</TD><TD style="TEXT-ALIGN: left">Daylesford</TD><TD>S Thompson</TD><TD style="TEXT-ALIGN: right">01-Sep</TD><TD style="TEXT-ALIGN: right">05-Aug</TD><TD> </TD><TD style="TEXT-ALIGN: right">$690.00</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">6</TD><TD style="TEXT-ALIGN: left">Melbourne</TD><TD>W & E Tindall</TD><TD style="TEXT-ALIGN: right">09-Sep</TD><TD style="TEXT-ALIGN: right">31-Aug</TD><TD> </TD><TD style="TEXT-ALIGN: right">$395.00</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">7</TD><TD style="TEXT-ALIGN: left">Broome</TD><TD>F & O Martinez</TD><TD style="TEXT-ALIGN: right">15-Sep</TD><TD style="TEXT-ALIGN: right">20-Aug</TD><TD> </TD><TD style="TEXT-ALIGN: right">$300.00</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">8</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">9</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">10</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">11</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">12</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">13</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD>Days Paid In Advance</TD><TD>Discount </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">14</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD style="TEXT-ALIGN: right">0</TD><TD style="TEXT-ALIGN: right">0%</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">15</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD style="TEXT-ALIGN: right">7</TD><TD style="TEXT-ALIGN: right">5%</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">16</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD style="TEXT-ALIGN: right">14</TD><TD style="TEXT-ALIGN: right">8%</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">17</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD style="TEXT-ALIGN: right">21</TD><TD style="TEXT-ALIGN: right">10%</TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">18</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">19</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">20</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR></TBODY></TABLE>
<TABLE style="BORDER-BOTTOM-STYLE: groove; BORDER-BOTTOM-COLOR: #00ff00; BORDER-RIGHT-STYLE: groove; BACKGROUND-COLOR: #fffcf9; BORDER-TOP-COLOR: #00ff00; FONT-FAMILY: Arial; BORDER-TOP-STYLE: groove; COLOR: #000000; BORDER-RIGHT-COLOR: #00ff00; FONT-SIZE: 10pt; BORDER-LEFT-STYLE: groove; BORDER-LEFT-COLOR: #00ff00"><TBODY><TR><TD>Spreadsheet Formulas</TD></TR><TR><TD><TABLE style="FONT-FAMILY: Arial; FONT-SIZE: 9pt" border=1 cellSpacing=0 cellPadding=2><TBODY><TR style="BACKGROUND-COLOR: #cacaca; FONT-SIZE: 10pt"><TD>Cell</TD><TD>Formula</TD></TR><TR><TD>E2</TD><TD>=C2-D2</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>

Excel tables to the web >> http://www.excel-jeanie-html.de/index.php?f=1" target="_blank"> Excel Jeanie HTML 4 </o:p>

<o:p></o:p>
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hey silk,
You don't really have to use a VLOOKUP, although I see why you would want to (but it's not necessary). The formula in E2 is fine, so you can just copy it down.

You can use a formula in G2 such as

Code:
=F2-(IF(E2>21,10%,IF(E2>14,8%,IF(E2>7,5%,0%)))*F2)
but to replace the VLOOKUP at point to the table, you could also use this

Code:
=F2-(IF(E2>$E$17,$F$17,IF(E2>$E$16,$F$16,IF(E2>$E$15,$F$15,$F$14)))*F2)
and copy down as needed

Let us know how it goes, and HTH's ;)

EDIT
To test, I also included this formula into H2, format as %

=(F2-G2)/F2
 
Last edited:
Upvote 0
Welcome to the board!

Your table looks to be set up correctly as is. The formula you are looking for to get discount % would look like this:

Code:
=vlookup(e2,$e$14:$f$17,2,1)
then if you want to take the discount out at the same time, it is:

Code:
=f2-f2*vlookup(e2,$e$14:$f$17,2,1)

FYI, the key here is the last term of the vlookup(), the 1. If it were zero, you'd be searching for an exact match (8 days in the first example), would not find it and would return an error. The 1 looks for closest match, and presumes that the table key (E14 thru E17) is sorted in ascending order...
 
Last edited:
Upvote 0
Hey,
Just curious, but I didn't go with the VLOOKUP because when it's used, and when the payment is made 7 days in advance, it applies a 5% discount, which I thought was incorrect as the OP stated 0-7 days (0%?), 8-14 days (5%)

I'm wondering whether I'm reading that correctly, or perhaps just going mad :eek:

If I am (reading correctly that is lol), should the table in E14:E17 then be 0, 8, 15, 22 for the VLOOKUP to work
 
Upvote 0
Good point, the table is probably not quite right...

Excel will pick the # of days that is less than or equal to the number of days you are looking for. So when you look for 8, it will find 7 days; look for 20 days and it finds 14. If you look for a number that is less than any of the key #s, Excel would return an error, so you should put some negative days in case the payment is late. Maybe more like this, or at least this should be illustrative of the values needed for the table:

Excel Workbook
EFGHIJ
13DaysDiscount--Differencecalced discount
14-9990%---10%
1505%--05%
1678%--15%
171410%--25%
18----78%
19----88%
20----138%
21----1410%
22----1510%
23----2310%
Sheet1
Cell Formulas
RangeFormula
J14=VLOOKUP(I14,$E$14:$F$17,2,1)
 
Upvote 0
Well that was my point really...
Because it looks at the data in that way, it applies the discount within the inclusive range of 0-6, 7-13 etc (ie 5% is applied at day 7) instead of the way the OP asked for it to be set as 0-7 (0%), 8-14 (5%) etc

....as I said tho, that's just how I'm reading it, and I could well be wrong
 
Upvote 0
Well that was my point really...
Because it looks at the data in that way, it applies the discount within the inclusive range of 0-6, 7-13 etc (ie 5% is applied at day 7) instead of the way the OP asked for it to be set as 0-7 (0%), 8-14 (5%) etc

....as I said tho, that's just how I'm reading it, and I could well be wrong

It's Silk here who started this thread.

I've read the comments about the percentage discount rates, and I'm not surprised that there is debate over it because I had some trouble with the lady I talked to about the Vlookup table.
These are the discount rates - :
less than 7 days 0%
7-13 days 5%
14-20 days 8%
21 days + 10%

if the VLOOKUP table (and formulas) should look different could you please advise (I'm doing this from an internet cafe and don't have the tiime to explore it too deeply)
 
Upvote 0
Hey Silk,
We all love to get to the root of the problem, and sometimes it's hard to all come to the same conclusions as you mention

In answer to your question, I would pay attention to taigovinda's first reply as that will give you the answers that you need, in the way you just mentioned

As a backup though, and as I mentioned in a previous post, if you are unsure and need to test the data, you may want to adopt the following.....if only to test it first

To test, I also included this formula into H2, format as %

=(F2-G2)/F2

Glad you got the result you need, and HTH's ;)

PS, Welcome to the board
 
Upvote 0
Hey Silk,
We all love to get to the root of the problem, and sometimes it's hard to all come to the same conclusions as you mention

In answer to your question, I would pay attention to taigovinda's first reply as that will give you the answers that you need, in the way you just mentioned

As a backup though, and as I mentioned in a previous post, if you are unsure and need to test the data, you may want to adopt the following

To test, I also included this formula into H2, format as %

=(F2-G2)/F2



Glad you got the result you need, and HTH's ;)

PS, Welcome to the board

By the way, thanks I appreciate the help you guys give
 
Upvote 0
Hey Silk,
We all love to get to the root of the problem, and sometimes it's hard to all come to the same conclusions as you mention

In answer to your question, I would pay attention to taigovinda's first reply as that will give you the answers that you need, in the way you just mentioned

As a backup though, and as I mentioned in a previous post, if you are unsure and need to test the data, you may want to adopt the following.....if only to test it first

To test, I also included this formula into H2, format as %

=(F2-G2)/F2

Glad you got the result you need, and HTH's ;)

PS, Welcome to the board

While my fascination with Taigovinda's post is endless, I just wish it didn't look like it was written in an ancient Chinese dialect.
Well, to me anyway.
I'm certainly interested in that post, but I just wish I could put it to more use.
I am really hopeless with this stuff. Like I said I've rushed into an internet cafe and will rush back out. I will try to get more involved with this later.
Could someone just tell me if the VLookup table looks right. When I double-checked it against some of the earlier posts it suddenly didn't look too bad.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,243
Members
449,075
Latest member
staticfluids

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