Multiple variable formula

jaybird2569

New Member
Joined
Sep 28, 2016
Messages
22
Good morning,
I have a sales sheet that I use to calculate goals based on the seniority level of each salesperson. The formula checks the amount in column "D" against the appropriate goals in "D1-D15" and returns a rating. Currently I can't just drag the formula down the entire column as there are different levels and goals. I have to edit each formula based on seniority levels. What I would like to do is have the formula check in column "C" for the level then, based on that level, use the appropriate formula. Any help is greatly appreciated.
Here is an example of my sheet.
open
https://drive.google.com/open?id=0BzCAijneXT6JR3VsTDRmM3RRZTRBV21KVExrMGExTzJuVS1B
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi,

Wish you had either provided a Table that we can copy into Excel to work with, or had uploaded the file Rather than just a Picture.

You'll need to make changes to the Levels Percentage Tables (L1, L2, L3, etc.) as in my Sample below, use E23 formula copied down for All your data:


Book1
ABCDE
1L10%
263.76%
370.00%
475.01%
5L20.00%
665.46%
772.00%
877.01%
9L30.00%
1067.16%
1174.00%
1279.01%
13L40.00%
1468.86%
1576.00%
1681.01%
17L50.00%
1870.56%
1978.00%
2083.01%
21
22MonthNameSeniority LevelSales GoalRating
23JanuaryJohnL171.00%3
Sheet69
Cell Formulas
RangeFormula
E23=IF(D23="","",IF(D23="N/A",3,LOOKUP(D23,CHOOSE(0+RIGHT(C23,1),D1:D4,D5:D8,D9:D12,D13:D16,D17:D20),{1,2,3,4})))
 
Last edited:
Upvote 0
Thank you jtakw!
I apologize for not uploading the file or making a table, I couldn't figure out how to do that. This works perfectly and I understand adding the 0.00% to the lookup and re-ordering the goals. Could you please explain the
(D23,CHOOSE(0+RIGHT(C23,1)
portion of the formula? This may come in very handy with other projects but would like to understand it better in order to adapt it properly.
Thank you again.
 
Upvote 0
You're welcome.

About posting samples:
Have a look at Item B here: https://www.mrexcel.com/forum/board-announcements/127080-guidelines-forum-use.html
and Post #2 here: https://www.mrexcel.com/forum/about-board/508133-attachments.html

To answer your question above:
The CHOOSE function needs an "Index" number to decide which "value" to return (in this case, which Cell Range to use for the LOOKUP), for that, I used the RIGHT function to extract from D23, the number "1" within "L1" (or 2 if it's L2, 3 if it's L3, etc.), however, the extraction returns a TEXT value, not a Real Number, adding 0 to it, converts it to a Real Number that the CHOOSE function would recognize.
 
Last edited:
Upvote 0
I will use those links on my next post to make it easier to understand.
Thank you for explaining that formula, makes much more sense.
 
Upvote 0
You're welcome.

To answer your question above:
The CHOOSE function needs an "Index" number to decide which "value" to return (in this case, which Cell Range to use for the LOOKUP), for that, I used the RIGHT function to extract from D23, the number "1" within "L1" (or 2 if it's L2, 3 if it's L3, etc.), however, the extraction returns a TEXT value, not a Real Number, adding 0 to it, converts it to a Real Number that the CHOOSE function would recognize.

You're welcome, as highlighted in Red above, I meant C23. typo
 
Upvote 0
I'll try to paste a table in here for clarification. Everything works great as you wrote it. I have one more column that counts backwards, the lower the number of days the better the rating. I tried putting the larger number at the top and also flipped the result_vector from 1,2,3,4 to 4,3,2,1 but it's not working correctly. If you can, see what I have wrong please.

>=20.71L120.70
18.00 - 20.69218.00
16.10 - 17.99316.09
0.00 - 16.0940.00
L219.55
The lower the number17.00
the better the rating14.99
0.00
L30.00
13.99
Levels 3 - 516.00
have the same goals18.40
L418.40
16.00
13.99
0.00
L50.00
13.99
16.00
18.40
MonthNameSeniority LevelDaysRating
JanuaryJohnL116.10#N/A
JanuaryBethL4n/a3
JanuaryFredL215.65#N/A
JanuarySam L113.50#N/A
JanuaryTammyL317.004
JanuaryStevenL510.211

<colgroup><col><col><col><col span="2"></colgroup><tbody>
</tbody>

Here's the formula I have in E23-E28
=IF(D23="","",IF(D23="N/A",3,LOOKUP(D23,CHOOSE(0+RIGHT(C23,1),$D$1:$D$4,$D$5:$D$7,$D$8:$D$12,$D$13:$D$16,$D$17:$D$20),{1,2,3,4})))
 
Last edited:
Upvote 0
Hi,

If I understand correctly, try it like my sample below, when testing for correct results, Pay Special Attention to the Cut Off points Between Ratings for Each Level -- (See where I changed your Rating 3 from 16.09 to 16.10 for Level 1)-- I did this because you've shown the logic for That level in your post, but you didn't show the logic for Levels 2 and 3, so I can't be sure it'll produce the correct results at the cutoff points.


Book1
ABCDE
1L10.00
216.10
318.00
420.70
5L20.00
614.99
717.00
819.55
9L30.00
1013.99
1116.00
1218.40
13L40.00
1413.99
1516.00
1618.40
17L50.00
1813.99
1916.00
2018.40
21
22MonthNameSeniority LevelDaysRating
23JanuaryJohnL116.103
24JanuaryBethL4N/A3
25JanuaryFredL215.653
26JanuarySamL113.504
27JanuaryTammyL317.002
28JanuaryStevenL510.214
Sheet78
Cell Formulas
RangeFormula
E23=IF(D23="","",IF(D23="N/A",3,LOOKUP(D23,CHOOSE(0+RIGHT(C23,1),D$1:D$4,D$5:D$8,D$9:D$12,D$13:D$16,D$17:D$20),{4,3,2,1})))


Formula copied down, let me know if we need to tweak the formula...
 
Upvote 0
That worked. I had the formula correct just didn't change the cut-off points correctly. Thanks again for all of your assistance and explanations. Have a great weekend!
 
Upvote 0
You're welcome, jaybird.

Please note, the "lookup vector" within the LOOKUP function Has to be in Ascending order (lowest to highest) to work properly, I see in you Post #7 , you had L1, L2, L4 backwards..., just so you know for future reference.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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