Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default seeking a smarter lookup function

Is there a single function that will look at a table array and see which
values the target number is between and return the appropriate result? There
are many, many values in the table array so if doesnt work.

For example, see the table below. If a particular cell's value is 260, that
would be between 250 and 300 and would return the value to the right in that
column, which is 200

400 450 300
350 400 250
300 350 200
250 300 150
200 250 100
150 200 50
100 150 0
50 100 0
0 50 0

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default seeking a smarter lookup function

I'm confused but that's easy for me at my age!!

Please re-explain the logic for returning 200 for the number 260 which i
agree is between 250 & 300

Mike

"Kim M." wrote:

Is there a single function that will look at a table array and see which
values the target number is between and return the appropriate result? There
are many, many values in the table array so if doesnt work.

For example, see the table below. If a particular cell's value is 260, that
would be between 250 and 300 and would return the value to the right in that
column, which is 200

400 450 300
350 400 250
300 350 200
250 --- 300 150
200 250 100
150 200 50
100 150 0
50 100 0
0 50 0

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default seeking a smarter lookup function

Sorry. I explained that badly. Let me simplify. Let's say these are sales
numbers. If I sold between $0 and $50 worth of stuff, I get no bonus. So I
want it to return 0. If I sold between $350 and $400 I get a $250 bonus.

With VLookup, I can say, look for this number, go over X columns, and return
the value. But that only works if there is an exact match. I want something
that will look at my table, figure out which set of numbers the starting
number is between, and give me what is in the third column of that row. Does
that make sense?

"Mike H" wrote:

I'm confused but that's easy for me at my age!!

Please re-explain the logic for returning 200 for the number 260 which i
agree is between 250 & 300

Mike

"Kim M." wrote:

Is there a single function that will look at a table array and see which
values the target number is between and return the appropriate result? There
are many, many values in the table array so if doesnt work.

For example, see the table below. If a particular cell's value is 260, that
would be between 250 and 300 and would return the value to the right in that
column, which is 200

400 450 300
350 400 250
300 350 200
250 --- 300 150
200 250 100
150 200 50
100 150 0
50 100 0
0 50 0

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default seeking a smarter lookup function

Is there a single function that will look at a table array and see which
values the target number is between and return the appropriate result?
There
are many, many values in the table array so if doesnt work.

For example, see the table below. If a particular cell's value is 260,
that
would be between 250 and 300 and would return the value to the right in
that
column, which is 200

400 450 300
350 400 250
300 350 200
250 300 150
200 250 100
150 200 50
100 150 0
50 100 0
0 50 0


Assuming the columns you show are A, B and C (all starting in row 1) and
that you particular data cell (the 260) is in D1...

=SUMPRODUCT((D1=A1:A9)*(D1<B1:B9)*C1:C9)

but to make this work, you should fill in the blank values with zeroes.

Rick

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default seeking a smarter lookup function

Kim,

yes that makes total sense. You need a table of sales and bonuses thus:-
A B
0 0
50 10
350 250
1000 300

Then a vlookup: =VLOOKUP(D1,A1:B2,2,TRUE)

With you sales in d1 until you hit 50 sales it will return zero at 50 it
will return 10
and so on. I.e. until it reaches the value in column A it will return the
lesser amount.

Mike




"Kim M." wrote:

Sorry. I explained that badly. Let me simplify. Let's say these are sales
numbers. If I sold between $0 and $50 worth of stuff, I get no bonus. So I
want it to return 0. If I sold between $350 and $400 I get a $250 bonus.

With VLookup, I can say, look for this number, go over X columns, and return
the value. But that only works if there is an exact match. I want something
that will look at my table, figure out which set of numbers the starting
number is between, and give me what is in the third column of that row. Does
that make sense?

"Mike H" wrote:

I'm confused but that's easy for me at my age!!

Please re-explain the logic for returning 200 for the number 260 which i
agree is between 250 & 300

Mike

"Kim M." wrote:

Is there a single function that will look at a table array and see which
values the target number is between and return the appropriate result? There
are many, many values in the table array so if doesnt work.

For example, see the table below. If a particular cell's value is 260, that
would be between 250 and 300 and would return the value to the right in that
column, which is 200

400 450 300
350 400 250
300 350 200
250 --- 300 150
200 250 100
150 200 50
100 150 0
50 100 0
0 50 0



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default seeking a smarter lookup function

Unfortunately that still returns zero.
E5 contains my value that I want to look for, which is 294.
Here is my vlookup:
=VLOOKUP(E5,B5:C13,2,TRUE)
It should return 125.


Here is my table:
400 200 294
350 175 0
300 150
250 125
200 100
150 75
100 50
50 25
0 0

"Mike H" wrote:

Kim,

yes that makes total sense. You need a table of sales and bonuses thus:-
A B
0 0
50 10
350 250
1000 300

Then a vlookup: =VLOOKUP(D1,A1:B2,2,TRUE)

With you sales in d1 until you hit 50 sales it will return zero at 50 it
will return 10
and so on. I.e. until it reaches the value in column A it will return the
lesser amount.

Mike




"Kim M." wrote:

Sorry. I explained that badly. Let me simplify. Let's say these are sales
numbers. If I sold between $0 and $50 worth of stuff, I get no bonus. So I
want it to return 0. If I sold between $350 and $400 I get a $250 bonus.

With VLookup, I can say, look for this number, go over X columns, and return
the value. But that only works if there is an exact match. I want something
that will look at my table, figure out which set of numbers the starting
number is between, and give me what is in the third column of that row. Does
that make sense?

"Mike H" wrote:

I'm confused but that's easy for me at my age!!

Please re-explain the logic for returning 200 for the number 260 which i
agree is between 250 & 300

Mike

"Kim M." wrote:

Is there a single function that will look at a table array and see which
values the target number is between and return the appropriate result? There
are many, many values in the table array so if doesnt work.

For example, see the table below. If a particular cell's value is 260, that
would be between 250 and 300 and would return the value to the right in that
column, which is 200

400 450 300
350 400 250
300 350 200
250 --- 300 150
200 250 100
150 200 50
100 150 0
50 100 0
0 50 0

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default seeking a smarter lookup function

DOH! I had to put the numbers low to high. Once I did, it worked. Thank you.

"Mike H" wrote:

Kim,

yes that makes total sense. You need a table of sales and bonuses thus:-
A B
0 0
50 10
350 250
1000 300

Then a vlookup: =VLOOKUP(D1,A1:B2,2,TRUE)

With you sales in d1 until you hit 50 sales it will return zero at 50 it
will return 10
and so on. I.e. until it reaches the value in column A it will return the
lesser amount.

Mike




"Kim M." wrote:

Sorry. I explained that badly. Let me simplify. Let's say these are sales
numbers. If I sold between $0 and $50 worth of stuff, I get no bonus. So I
want it to return 0. If I sold between $350 and $400 I get a $250 bonus.

With VLookup, I can say, look for this number, go over X columns, and return
the value. But that only works if there is an exact match. I want something
that will look at my table, figure out which set of numbers the starting
number is between, and give me what is in the third column of that row. Does
that make sense?

"Mike H" wrote:

I'm confused but that's easy for me at my age!!

Please re-explain the logic for returning 200 for the number 260 which i
agree is between 250 & 300

Mike

"Kim M." wrote:

Is there a single function that will look at a table array and see which
values the target number is between and return the appropriate result? There
are many, many values in the table array so if doesnt work.

For example, see the table below. If a particular cell's value is 260, that
would be between 250 and 300 and would return the value to the right in that
column, which is 200

400 450 300
350 400 250
300 350 200
250 --- 300 150
200 250 100
150 200 50
100 150 0
50 100 0
0 50 0

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Desperately seeking ACTIVE.WORKBOOK function for XLM arcibald tuttle Excel Worksheet Functions 0 February 21st 11 01:25 PM
Seeking Improvement on excel function wilchong via OfficeKB.com New Users to Excel 27 September 4th 09 04:24 AM
Smarter way out will be to follow the market tips... supertrader07 New Users to Excel 1 August 3rd 07 04:38 AM
Smarter Idea Lp12 Excel Worksheet Functions 4 March 6th 07 11:38 AM
is word really smarter than excel? Bill Kuunders Excel Programming 4 February 7th 05 09:59 AM


All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"