Unable to get desired result from formula

naiku

New Member
Joined
Mar 17, 2011
Messages
4
I am sure this will turn out to be one of those moments where something is blindingly obvious, but it is late on Friday afternoon, and I can't get this to work.

This is what I want to achieve. I have a spreadsheet with 3 columns, one of these is a job, the next is a user entered date, the next is a calculated date. I want Excel to look at the 2nd date, if this is listed as TBD, I want it to perform a vlookup to some date on another worksheet, then compare the found date to the 1st date, if the 1st date is after the 2nd (looked up) date, I want the cell to show the 1st date. If the 2nd date is after the 1st date, I want the cell to show the 2nd date.

At the moment I am getting no dates, when I know I should be getting some. This is the formula I have entered:

=IF(F4="TBD",(IF(DATEDIF(E4,(VLOOKUP(A4,Sheet4!$A$2:$B$519,2,FALSE)),"D")<0,E4,(IF(F4="TBD",(VLOOKUP(A4,Sheet4!$A$2:$B$519,2,FALSE)),F4)))))

I am sure it is just something like a ( or a comma in the wrong place.

Thanks.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
There is no need for DateDif() to tell if one date is greater than another. Just ordinary comparison operators will work ( >, >=, =, <=, < )

Perhaps:
=IF(F4="TBD",IF(VLOOKUP(A4,Sheet4!$A$2:$B$519,2,FALSE)>E4,VLOOKUP(A4,Sheet4!$A$2:$B$519,2,FALSE),E4),F4)

But you haven't made it clear what to do if the dates are equal.


If this doesn't work and you are still stuck, give example data to work with, and a sample of the desired result, so someone can more easily help.

ξ
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,480
Members
452,915
Latest member
hannnahheileen

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