×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Need help finding where a number lies within a set of values

## Need help finding where a number lies within a set of values

(OP)
I work for an insurance company and they are changing their commission payment structure. I was given a .pdf grid that contained the values they want to use to determine commission rates. I recreated the .pdf in a table and have included an image of both the .pdf and the table side by side for comparison.

What I'm trying to accomplish is to take a volume value that is generated in a report of total production and find where that numeric value falls in the table. Example would be that one agent had a volume of 143 last month. She is obviously between 140 and 164. The brain does that quite easily, but how do I tell Access to find which table field is the appropriate place? I have added a numeric identifier column to the table, so that <25 = 1, and Between 25 And 39 = 2, etc. I can then use that identifier to determine what the maximum commission to be paid should be. Nothing above level 1 will be considered for anyone with a volume of <25, for example.

The overall commission rate is dependent on both Volume and Close Rate, which is why "<25" is listed twice, as is "Between 25 and 39". I don't want to go too deeply into this whole crazy structure, but if volume <25 and the Close Rate is <40%, they get paid 2%, but if the same volume has a Close Rate of 40% or more they get paid 3%. The words "or more" mean that at that level of volume, even with a 75% close ratio it would still be 3% payment, but if the volume were >195 the payment would be 7% for that close rate.

I just explained that so it would make a little sense, but the real question I have is how I identify the ordinal number that corresponds to a given field value in Access. I can hard-code it of course, but they want to be able to modify those values in the table and have the system respond to any new numbers. That's why I need to figure out how to get Access to identify which group a given field value falls into.

I'm working directly with Admin and I'm confused, so I won't be surprised if others are as well.

Another way to think of it is that the volume determines what the maximum close rate that will be paid. In the earlier example of a volume of 143 her actual Close Rate is 62.8%. But because of her volume the maximum close rate that can be considered for her is 57.5% on the same line with the 140+. She will be paid 4.25%. However, if her close rate had been 51% she would have been paid 3.5%.

I think if someone can show me how to find the Volume in that list I can take it from there and worry about the Close Rate stuff and eventually identify the Commission Rate, so most of this isto give you something to wrap your heads around Bottom line, I'm trying to figure out how to place a field value showing Volume within the parameters shown.

As always, thank you all in advance for your help. I'm pulling what little hair I have out with this one.

### RE: Need help finding where a number lies within a set of values

If I understand correctly, you can calculate independently commission rate dependent in the Volume and Close rate and take minimum.
If so, I would create two tables:
1) Volume - Rate (as difference between levels)
Vol    Rate
0      3.00%
25     0.75%
40     0.25%
140    0.25%
... 
2) Close Rate - Rate (as difference between levels
CRate  Rate
0.0%  2.00%
40.0%  1.00%
50.0%  0.50%
... 
Next, having a Volume sum up volume commisions for volumes lower or equal to input volume. Do the same for Close rate input. Take minimum.
As example, for Volume 30 commision for volume is 3.75%. For Close rate 60% commision for rate is 4.5%, minimum of those is 3.75%.

combo

### RE: Need help finding where a number lies within a set of values

(OP)
Thank you so much for your input, combo. I really appreciate the effort.

However, I laid awake for a long time last night pondering this and I think that I have finally seen the solution I need.

I came to realize that I made a mistake from the first moment I approached this when I tried to recreate the .pdf in an Access table. I was trying to get, in tabular form, the visual impact of the .pdf, but it didn't provide Access with what it needs. The first change I have to make is to create two fields for Call Volume... fields that contain a lower and an upper limit. For example, the first value's lower limit is 1 and upper limit is 24.

As far as call volume is concerned, I also realized that I actually only need one number to make it work. Consider a table field whose upper limit values are, based on table before, 24, 25, 40, 140, 165, 175, 185, 195. Now I can use a simple select query and display all table values that are less than the data field which contains volume info. If we consider the 143 volume I spoke of earlier, then the results of the query would be everything less than or equal to 143, namely 24, 25, 40, and 140. From the table values previously offered, the corresponding available Close Rate list would be 0, 40, 50, 52.5, 55, and 57.5, and the associated available Commission Rates would be 2%, 3%, 3.5%, 3.78%, 4%, and 4.25%.

I haven't yet actually made this work, but I think the solution may be a second query based on the results of the first. Regardless of how I ultimately do it, the actual close rate would be compared to the available list. The real-world Close Rate for the Agent that produced the volume of 143 was 62.917%. I would use the Max function on a query to compare the true close rate to the available table values. In this case, the Max value of the available options that is less than 62.917 is 57.5, so the associated Commission Rate to the right on that line of 4.25% would be the appropriate value. If we consider what would happen if her close rate had been 51%, then the same process would leave 50 as the highest available number which is less than the actual close rate, so looking across the table at the line where 50 is would give a 3.5% Commission Rate.

You and I came up with similar approaches, but I think my solution is more direct because it uses the actual values rather than differences between values.

I'm really hopeful that this will solve my problem, but I'm open to any suggestions. If anyone has other ideas I'd love to hear them.

Regardless, please know that I'm always extremely appreciative of those who take time to help when they get nothing for it except the satisfaction of lending someone else a hand.

### RE: Need help finding where a number lies within a set of values

(OP)
By the way, I had a chance to test that and it worked great!

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!