Vlookup with IF's and multiple conditions

PhantomJoe

New Member
Joined
Sep 7, 2017
Messages
22
I'm not sure why this is stumping me but I've been struggling to find the right solution to solve for the following.

I have a table of data that is used to determine cancellation percentages based on a number of factors.

The first factor is the "Position Assignment" (found in column U) and values in this column can be one of 8 values like "Direct Hire Business" and "Direct Hire Technical".

The next check is against the number of "Days Open" (column R) for the requisition. Depending on the specific Position Assignment the ranges will vary. Here's an example:
[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD]Position Assignment[/TD]
[TD]Days Open[/TD]
[TD]% of Fee[/TD]
[TD]Days Open[/TD]
[TD]% of Fee[/TD]
[TD]Days Open[/TD]
[TD]% of Fee[/TD]
[/TR]
[TR]
[TD]Direct Hire Technical[/TD]
[TD]<4 Days[/TD]
[TD]0%[/TD]
[TD]5-14 Days[/TD]
[TD]50%[/TD]
[TD]15+ Days[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]FCG/LP[/TD]
[TD]<30 Days[/TD]
[TD]0%[/TD]
[TD]31-44 Days[/TD]
[TD]25%[/TD]
[TD]45+ Days[/TD]
[TD]100%[/TD]
[/TR]
</tbody>[/TABLE]




<table border="0" cellpadding="0" cellspacing="0" verdana,="" arial,="" tahoma,="" calibri,="" geneva,="" sans-serif;"="" width=""><colgroup><col></colgroup><tbody></tbody></table>



So the above table contains the logic Cancellation Fees based on Position Assignments and if it's closed within the X days then the % of Fee will be assigned based on how long the Req was open. So if it was a Direct Hire Technical and open for 9 days then the % of Fee would be 50%.

The formula I think I'm looking for would first do a lookup based on the Position Assignment and then check the Days Open column to see what range it falls in then assign the % of Fee based on those 2 factors.

Is this doable with an if/vlookup formula?
 

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.
@ PhantomJoe

Try to re-arrange the look up table you have as follows:

[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][td]
B​
[/td][td]
C​
[/td][td]
D​
[/td][td]
E​
[/td][td]
F​
[/td][td]
G​
[/td][/tr][tr][td]
1​
[/td][td]Position Assignment[/td][td]Days Open[/td][td][/td][td][/td][td]% of Fee[/td][td][/td][td][/td][/tr]
[tr][td]
2​
[/td][td]Direct Hire Technical[/td][td]
4
[/td][td]
5​
[/td][td]
15
[/td][td]
0%
[/td][td]
50%
[/td][td]
100%
[/td][/tr]
[tr][td]
3​
[/td][td]FCG/LP[/td][td]
30
[/td][td]
31
[/td][td]
45
[/td][td]
0%
[/td][td]
25%
[/td][td]
100%
[/td][/tr]
[/table]


This table is easier to use as shown below:

[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][td]
B​
[/td][td]
C​
[/td][/tr][tr][td]
5​
[/td][td]Direct Hire Technical[/td][td]
2​
[/td][td]
0​
[/td][/tr]
[tr][td]
6​
[/td][td]Direct Hire Technical[/td][td]
4​
[/td][td]
0​
[/td][/tr]
[tr][td]
7​
[/td][td]Direct Hire Technical[/td][td]
7​
[/td][td]
0.5​
[/td][/tr]
[tr][td]
8​
[/td][td]FCG/LP[/td][td]
32​
[/td][td]
0.25​
[/td][/tr]
[tr][td]
9​
[/td][td]FCG/LP[/td][td]
50​
[/td][td]
1​
[/td][/tr]
[tr][td]
10​
[/td][td]FCG/LP[/td][td]
20​
[/td][td]
0​
[/td][/tr]
[/table]


In C5 enter (and copy down for other pairs of look up values)...

=IFNA(LOOKUP($B5,INDEX($B$2:$D$3,MATCH($A5,$A$2:$A$3,0),0),INDEX($E$2:$G$3,MATCH($A5,$A$2:$A$3,0),0)),0)

If you get a #NAME ? error, replace IFNA with IFERROR.
 
Upvote 0
@ PhantomJoe

Try to re-arrange the look up table you have as follows:

[TABLE="class: grid"]
<tbody>[TR]
[TD]Row\Col[/TD]
[TD]
A​
[/TD]
[TD]
B​
[/TD]
[TD]
C​
[/TD]
[TD]
D​
[/TD]
[TD]
E​
[/TD]
[TD]
F​
[/TD]
[TD]
G​
[/TD]
[/TR]
[TR]
[TD]
1​
[/TD]
[TD]Position Assignment[/TD]
[TD]Days Open[/TD]
[TD][/TD]
[TD][/TD]
[TD]% of Fee[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
2​
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]
4
[/TD]
[TD]
5​
[/TD]
[TD]
15
[/TD]
[TD]
0%
[/TD]
[TD]
50%
[/TD]
[TD]
100%
[/TD]
[/TR]
[TR]
[TD]
3​
[/TD]
[TD]FCG/LP[/TD]
[TD]
30
[/TD]
[TD]
31
[/TD]
[TD]
45
[/TD]
[TD]
0%
[/TD]
[TD]
25%
[/TD]
[TD]
100%
[/TD]
[/TR]
</tbody>[/TABLE]


This table is easier to use as shown below:

[TABLE="class: grid"]
<tbody>[TR]
[TD]Row\Col[/TD]
[TD]
A​
[/TD]
[TD]
B​
[/TD]
[TD]
C​
[/TD]
[/TR]
[TR]
[TD]
5​
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]
2​
[/TD]
[TD]
0​
[/TD]
[/TR]
[TR]
[TD]
6​
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]
4​
[/TD]
[TD]
0​
[/TD]
[/TR]
[TR]
[TD]
7​
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]
7​
[/TD]
[TD]
0.5​
[/TD]
[/TR]
[TR]
[TD]
8​
[/TD]
[TD]FCG/LP[/TD]
[TD]
32​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
[TR]
[TD]
9​
[/TD]
[TD]FCG/LP[/TD]
[TD]
50​
[/TD]
[TD]
1​
[/TD]
[/TR]
[TR]
[TD]
10​
[/TD]
[TD]FCG/LP[/TD]
[TD]
20​
[/TD]
[TD]
0​
[/TD]
[/TR]
</tbody>[/TABLE]


In C5 enter (and copy down for other pairs of look up values)...

=IFNA(LOOKUP($B5,INDEX($B$2:$D$3,MATCH($A5,$A$2:$A$3,0),0),INDEX($E$2:$G$3,MATCH($A5,$A$2:$A$3,0),0)),0)

If you get a #NAME ? error, replace IFNA with IFERROR.

This worked perfectly. All I had to do was replace the IFNA with IFERROR and it worked like a charm. Thank you so much!
 
Upvote 0
I'm not sure why this is stumping me but I've been struggling to find the right solution to solve for the following.

I have a table of data that is used to determine cancellation percentages based on a number of factors.

The first factor is the "Position Assignment" (found in column U) and values in this column can be one of 8 values like "Direct Hire Business" and "Direct Hire Technical".

The next check is against the number of "Days Open" (column R) for the requisition. Depending on the specific Position Assignment the ranges will vary. Here's an example:
[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD]Position Assignment[/TD]
[TD]Days Open[/TD]
[TD]% of Fee[/TD]
[TD]Days Open[/TD]
[TD]% of Fee[/TD]
[TD]Days Open[/TD]
[TD]% of Fee[/TD]
[/TR]
[TR]
[TD]Direct Hire Technical[/TD]
[TD]<4 Days[/TD]
[TD]0%[/TD]
[TD]5-14 Days[/TD]
[TD]50%[/TD]
[TD]15+ Days[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]FCG/LP[/TD]
[TD]<30 Days[/TD]
[TD]0%[/TD]
[TD]31-44 Days[/TD]
[TD]25%[/TD]
[TD]45+ Days[/TD]
[TD]100%[/TD]
[/TR]
</tbody>[/TABLE]
Hi!

Another table format and with OFFSET function.

If is possible the table format of the range A1:D7, then the formula below can help you:

=IFERROR(LOOKUP($R2,N(OFFSET($B$1,{1;3;5},MATCH($U2,$B$1:$D$1,0)-1)),
N(OFFSET($B$1,{2;4;6},MATCH($U2,$B$1:$D$1,0)-1))),0)


[TABLE="class: grid, width: 897"]
<tbody>[TR]
[TD]
[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[TD]T[/TD]
[TD]U[/TD]
[TD]V[/TD]
[TD]W[/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]FCG/LP[/TD]
[TD]Direct Hire Business[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Days Open[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Position Assignment[/TD]
[TD]
[/TD]
[TD]% of Fee[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Days Open[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]32[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Direct Hire Business[/TD]
[TD]
[/TD]
[TD]0,1[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]% of Fee[/TD]
[TD]0,01[/TD]
[TD]0,02[/TD]
[TD]0,03[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]2[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]
[/TD]
[TD]0,01[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Days Open[/TD]
[TD]5[/TD]
[TD]31[/TD]
[TD]10[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]18[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]
[/TD]
[TD]1[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]% of Fee[/TD]
[TD]0,5[/TD]
[TD]0,25[/TD]
[TD]0,1[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]13[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Direct Hire Business[/TD]
[TD]
[/TD]
[TD]0,1[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Days Open[/TD]
[TD]15[/TD]
[TD]45[/TD]
[TD]50[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]11[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Direct Hire Technical[/TD]
[TD]
[/TD]
[TD]0,5[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]% of F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/TR]
[TR]
[TD]19[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]41[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]Direct Hire Business[/TD]
[TD]
[/TD]
[TD]0,1[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]20[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]5[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]FCG/LP[/TD]
[TD]
[/TD]
[TD]0,02[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]21[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]***[/TD]
[TD]***********[/TD]
[TD]********************[/TD]
[TD]********[/TD]
[TD]*******************[/TD]
[TD]**[/TD]
[TD]**[/TD]
[TD]***********[/TD]
[TD]**[/TD]
[TD]**[/TD]
[TD]********************[/TD]
[TD]**[/TD]
[TD]*********[/TD]
[TD]**[/TD]
[/TR]
</tbody>[/TABLE]


Markmzz
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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