Comination formula with IF and VLOOKUP, returning opposite results

Jessicam3

New Member
Joined
Apr 26, 2023
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
I have a complex formula going and for some reason the only way it returns the correct answer on the last portion of the formula is if the greater/less than sign is flipped around? I enlarged the specific sign that I have currently have flipped around so the formula works, but the way it should read is that if the vlookup is greater than, not less than. Can anyone help with this? Thanks!

=IF(F28=1,IF(VLOOKUP(G28,$AB$2:$AC$15,2,FALSE)>=T28,T28,T28+U28),IF(VLOOKUP(F28,$Z$2:$AA$26,2,FALSE)<=T28,T28,T28+U28))
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi @Jessicam3. Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.

=IF(F28=1,IF(VLOOKUP(G28,$AB$2:$AC$15,2,FALSE)>=T28,T28,T28+U28)
That part of the formula is true if F28 is equal to 1.
If it is not equal to 1 then the second part of your formula is done.

Your formula works fine, here are the 4 possible cases:
Dante Amor
AEFGHIJSTUVWXYZAAABAC
1
2112
32520
4313
544
655
766
877
988
2524
2625
27
2811118
2912918
302338
3131028
Hoja2
Cell Formulas
RangeFormula
I28:I31I28=IF(F28=1,IF(VLOOKUP(G28,$AB$2:$AC$15,2,0)>=T28,T28,T28+U28),IF(VLOOKUP(F28,$Z$2:$AA$26,2,0)>=T28,T28,T28+U28))


Review which of those cases does not work for you and tell us.
-------------
I hope to hear from you soon.
Respectfully
Dante Amor
--------------
 
Upvote 1
Hi & welcome to MrExcel.

Can you post some sample data showing the problem.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Thank you I had no idea how to add this into the thread. Hopefully this section of my spreadsheet will help claify my issue. the highlighted rows are not calculating correctly.

FY24 wages.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABAC
1GrademaxStepmax
21ND23.63
32A24.30
4324.30B-
5426.33C-
6527.00D-
76E25.65
8727.68E-ND27.00
98F-
10930.38G27.00
1110H27.68
121132.40I28.35
1312J-
141331.73K29.36
1514
161537.13
1716
181743.88
19Monthsyearsraise18
200-11less than a year0.001941.77
2112-351-20.2520
2236-713-50.502144.36
2372+6+0.7522
242345.66
2524
26monthsgradehoursCurrentmaxdifferencetest25-
27
2811198026.9541.77(14.82)(10.82)4.0030.950.0030.9564,376.000.00
2936198027.2041.77(14.57)(10.07)4.0031.200.5031.7065,936.000.00
3020438021.8624.30(2.44)0.312.0023.860.7524.6151,188.800.00
311858016.5027.00(10.50)(6.75)3.5020.000.2520.2542,120.000.00
323198018.7530.38(11.63)(7.38)4.0022.750.2523.0047,840.000.00
3335755025.7227.00(1.28)2.973.5029.220.7529.2237,986.000.00
3421656019.5527.00(7.45)(3.20)3.5023.050.7523.8037,128.000.00
3534138021.7531.73(9.98)(6.73)3.0024.750.2525.0052,000.000.00
36
Formula testing page ONLY
Cell Formulas
RangeFormula
P28:P35P28=IF(F28=1,VLOOKUP(G28,$AB$2:$AC$15,2,FALSE),VLOOKUP(F28,$Z$2:$AA$26,2,FALSE))
Q28:Q35Q28=O28-P28
R28:R35R28=Q28+(S28+U28)
T28:T35T28=IF(F28=1,IF(VLOOKUP(G28,$AB$2:$AC$14,2,FALSE)>=O28,O28,O28+S28),IF(VLOOKUP(F28,$Z$2:$AA$26,2,FALSE)<=O28,O28,O28+S28))
U28:U35U28=IF(C28>=72,$Y$23,IF(C28>=36,$Y$22,IF(C28>=12,$Y$21,IF(C28<=11,$Y$20))))
V28:V35V28=IF(F28=1,IF(VLOOKUP(G28,$AB$2:$AC$15,2,FALSE)>=T28,T28,T28+U28),IF(VLOOKUP(F28,$Z$2:$AA$26,2,FALSE)<=T28,T28,T28+U28))
W28:W35W28=V28*N28*26
X28:X35X28=IF(O28=V28,((U28+S28)*N28*26),0)
 
Upvote 0
seems like might be reading the formula like a sentence, not like a math equation.
the opening of the < or > will be open to the larger number for the statement to be true
• amount should be bigger < other amount =false
• amount should be bigger > other amount =true
dont think of it as larger amount is greater than other amount
more like: 1<2 & 2>1

so if you're trying to say that the vlookup is larger than t28, then
=IF(F28=1,IF(VLOOKUP(G28,$AC$2:$AD$15,2,0)>=T28,T28,T28+U28),IF(VLOOKUP(F28,$AA$2:$AB$26,2,0)>=T28,T28,T28+U28))
would do just that
 
Upvote 0
Can you explain why the two rows in blue are wrong, but the others are right.
 
Upvote 0
I see my own problem! I need to somehow take the formula one step farther or add another column. The value that is being added is making the total over the requred max, so I somehow have to account for that. Such as in row 33, the max is 27, and the starting value is 25.72, so the formula in Column T is allowing the addition of 3.50, but that makes the value higher than the set max. The same thing is happening in row 30 and column V. Any suggestions for that?
 
Upvote 0
Ok, how about
Excel Formula:
=IF(F28=1,IF(VLOOKUP(G28,$AB$2:$AC$15,2,FALSE)>=T28,T28,T28+U28),MIN(P28,IF(VLOOKUP(F28,$Z$2:$AA$26,2,FALSE)<=T28,T28,T28+U28)))
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,676
Members
449,463
Latest member
Jojomen56

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