Nested IF statement

Paul long

New Member
Joined
Apr 29, 2024
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,
New to the board.
I'm struggling with a nested IF on a sheet that logs fork lift repairs.
Column K allows me to mark with a "Y" if the job is complete, and if so I want column N to calculate the number of days between the reported date and the repaired date, if it's not been repaired yet, then calculate the number of days between today and the date it was reported.
Picture1.png

In column N I have =IF(K4="Y",(L4-A4),(A2-A4)) As you can see it works if the job is completed, but if there is no "Y" in K, then I want it to calculate days to today since we logged it. As you can see in N5, it doesnt like it.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi, welcome to the board!

The #VALUE! error would indicate that either A2 or A5 are text rather than dates - do you have a formula in cell A2 that is returning today's date? If so, what is it?
 
Upvote 0
Hi, welcome to the board!

The #VALUE! error would indicate that either A2 or A5 are text rather than dates - do you have a formula in cell A2 that is returning today's date? If so, what is it?
Thanks for that,
Column A & L are formatted as dates.
A2 has the formula =TODAY()
 
Upvote 0
To help diagnose, if you put these formulas in spare cells, what do they return?

=ISNUMBER(A2)
=ISNUMBER(A5)
 
Upvote 0
I think you need to use Absolute reference for cell A2:
Excel Formula:
=IF(K4="Y",L4-A4,$A$2-A4)

And are you sure column A is a date formatted column? (Select column A, change format to "General", do the dates get converted to numbers?)
 
Upvote 0
I think you need to use Absolute reference for cell A2:
Excel Formula:
=IF(K4="Y",L4-A4,$A$2-A4)

And are you sure column A is a date formatted column? (Select column A, change format to "General", do the dates get converted to numbers?)
Tried switching it and it changed to numbers, changed it back to this...

1714385357561.png
 
Upvote 0
I think you need to use Absolute reference for cell A2:
I think this is likely the answer. Copy and paste the formula that is returning the #VALUE! in a reply here.
 
Upvote 0
would you be kind enough to post your data in a table or use the xl2bb add in (preferable). I cannot read your image in post 1, to try to recreate your scenario.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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