Why is IF returning #VALUE!? Seem correct to me.

Camel123

Board Regular
Joined
Jun 5, 2018
Messages
186
Hi,

Below is part of the formula. The error is in the beginning.

When evaluating; first logic test= FALSE, instead of running the formula in the "FALSE" section, it returns #VALUE !. Why? I can not see anything wrong.



=IF(D4="";"manual";IF(DATEVALUE(INDEX('planned'!J:J;MATCH('booked'!D4;'planned'!E:E;0)))<DATEVALUE($E$2)... formula continues...
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
What is the index/match returning? If the DATEVALUE does not know what date the text is then you will get a value error.
 
Upvote 0
You can put the complete formula and a sample of your data. And from those data what is the result you expect.
 
Upvote 0
So here is the whole formula :)

Sheet "booked accruals"
D4= purchase order number to be found in the other sheet
E2= current month (manually set)

Sheet "accruals planning"
I:I= start date
J:J end date
K:K datedif between start and end date in months


=IF(D4="";"manual";IF(DATEVALUE(INDEX('Accruals planning'!J:J;MATCH('Booked accruals'!D4;'Accruals planning'!E:E;0)))<DATEVALUE($E$2);INDEX('Accruals planning'!K:K;MATCH('Booked accruals'!D4;'Accruals planning'!E:E;0));IF(DATEVALUE(INDEX('Accruals planning'!I:I;MATCH('Booked accruals'!D4;'Accruals planning'!E:E;0)))=DATEVALUE($E$2);"1";IF(DATEVALUE(INDEX('Accruals planning'!I:I;MATCH('Booked accruals'!D4;'Accruals planning'!E:E;0)))>DATEVALUE($E$2);"future";IF(INDEX('Accruals planning'!I:I;MATCH('Booked accruals'!D4;'Accruals planning'!E:E;0))="";"manual";DATEDIF(INDEX('Accruals planning'!I:I;MATCH('Booked accruals'!D4;'Accruals planning'!E:E;0));'Booked accruals'!$E$2;"M"))))))
 
Upvote 0
It looks like the returned value is already a date, so remove the DATEVALUE() function.
 
Upvote 0
I thought DATEVALUE converted dates to numerical values and not the opposit.. well, learnt something new at least! :laugh::laugh: Thank you Rory again for your support, and to all other people trying to help me out <3

It works now!
 
Last edited:
Upvote 0
No, DATEVALUE is for converting a text representation of a date to a true date value. (In Excel all dates are stored as numbers anyway)
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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