Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 70
Default If formula producing #VALUE Error

I'm trying to set up a spreadsheet that has a contiguous set of dates that decrease by 7 days each row. I want it to stop at January 1st of every year (ideally, I'd like to not hardcode the year, but I did it that way as a test run). I tried this formula:

=IF(OR($A35=DATE(2012,1,1),""),"",$A35-7)

But I'm getting a #VALUE error. My dates are formatted as a date in M/D/YYYY format. It works fine without the "OR" statement (so it's not flagging empty cells). If the cell is blank without the OR, then I get #VALUE error (that one I understand). It seems that adding the blank cell conditional is messing things up. Any help is appreciated!

Last edited by KeriM : August 16th 12 at 05:46 PM Reason: Added more information
  #2   Report Post  
Member
 
Posts: 70
Default

Quote:
Originally Posted by KeriM View Post
I'm trying to set up a spreadsheet that has a contiguous set of dates that decrease by 7 days each row. I want it to stop at January 1st of every year (ideally, I'd like to not hardcode the year, but I did it that way as a test run). I tried this formula:

=IF(OR($A35=DATE(2012,1,1),""),"",$A35-7)

But I'm getting a #VALUE error. My dates are formatted as a date in M/D/YYYY format. It works fine without the "OR" statement (so it's not flagging empty cells). If the cell is blank without the OR, then I get #VALUE error (that one I understand). It seems that adding the blank cell conditional is messing things up. Any help is appreciated!
My boss spotted my mistake. I needed to specify $A35 again, so it should have read:

=IF(OR($A35=DATE(2012,1,1),$35=""),"",$A35-7)
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default If formula producing #VALUE Error

"KeriM" wrote:
I'm trying to set up a spreadsheet that has a contiguous set of dates
that decrease by 7 days each row. I want it to stop at January 1st of
every year (ideally, I'd like to not hardcode the year, but I did it
that way as a test run). I tried this formula:
=IF(OR($A35=DATE(2012,1,1),""),"",$A35-7)
But I'm getting a #VALUE error.


Perhaps:

=IF(OR($A35="",MONTH($A35)=1),"",$A35-7)

That does assume that =ISNUMBER(A35) et al is TRUE. If not, post an update
and tell us more about the contents of A35 et al.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default If formula producing #VALUE Error

Errata.... I wrote:
=IF(OR($A35="",MONTH($A35)=1),"",$A35-7)


That does result in a #VALUE error if the value of A35 is the null string
(""). One of the following is better:

=IF($A35="","",IF(MONTH($A35)=1,"",$A35-7))

=IF(OR($A35="",MONTH(N($A35))=1),"",$A35-7)

=IF(MONTH(N($A35))=1,"",$A35-7)

In the second formula, the test $A35="" is actually redundant, as
demonstrated by the third formula. But it might be more intuitive. Then
N() function returns zero if $A35 is non-numeric.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula problems that keep producing a #Value! Error!! Danny Boy Excel Worksheet Functions 10 June 21st 09 06:11 PM
WorksheetFunction.Index producing error Brad E. Excel Programming 1 March 3rd 09 04:48 PM
Formula for producing one list from another ! Chuckee Excel Worksheet Functions 2 February 21st 07 11:15 PM
Name a formula producing an array hmm Excel Worksheet Functions 3 December 19th 06 09:28 AM
sum formula not working, producing incorrect answers Excel 2003 crzyg8r Excel Discussion (Misc queries) 5 January 14th 06 09:09 PM


All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"