Nested IF formula - HELP PLEASE

janema

Board Regular
Joined
Nov 28, 2022
Messages
143
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2011
  5. 2010
Platform
  1. Windows
  2. Mobile
I am trying to get this formula (in column F to calculate the time in role, but with multiple conditions. My formula currently is:

=IF(G5="","",IFERROR(DATEDIF(G5,$I$1,"y")&" yrs "&DATEDIF(G5,$I$1,"ym")&" mos",""))

Note: the current date is a hidden cell that is locked in the formula because that date will just be "today's date"

What I am trying to do is all of the above, but ALSO add in that if column D is "N/A" then to use the dates from column K and the "current date" to calculate the time in current role. PLEASE HELP.

1673376294934.png

When I add in that nested formula, it keeps telling me I have too many arguments. :(

Tried this and no luck:

=IF(G5="","",IF(G5="N/A",DATEDIF(G5,$I$1,"y")&" yrs "&DATEDIF(G5,$I$1,"ym")&" mos"), IFERROR(DATEDIF(G5,$I$1,"y")&" yrs "&DATEDIF(G5,$I$1,"ym")&" mos",""))

So CONFUSED.

Essentially, I want the formula to give me the current time in role, but if column D is blank, just to leave it blank, and if column D is "N/A" then to use the date in column K instead of the current date I am using
.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Your formula & image don't match up, so this is based on the image
Excel Formula:
=IF(D5="","",IFERROR(DATEDIF(IF(D5="N/A",K5,D5),$I$1,"y")&" yrs "&DATEDIF(IF(D5="N/A",K5,D5),$I$1,"ym")&" mos",""))
 
Upvote 0
Solution
Your formula & image don't match up, so this is based on the image
Excel Formula:
=IF(D5="","",IFERROR(DATEDIF(IF(D5="N/A",K5,D5),$I$1,"y")&" yrs "&DATEDIF(IF(D5="N/A",K5,D5),$I$1,"ym")&" mos",""))
THANK YOU SO MUCH!! That worked perfectly!! You are amazing!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,964
Messages
6,175,659
Members
452,666
Latest member
AllexDee

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