+ Reply to Thread
Results 1 to 12 of 12

IF function anomaly

  1. #1
    Registered User
    Join Date
    12-07-2007
    MS-Off Ver
    Office Pro 2000 & 2007
    Posts
    26

    IF function anomaly

    Hi

    I have an IF statement which shows the expected answer in the formula wizard, but returns "#VALUE!" in the cell, depending on location. The formula displays correctly if it's in the same column as one of the queried cells, but doesn't if placed anywhere else.
    I have checked the cell formatting and this is the same throughout the sheet.

    The spreadsheet has been written in Excel 2000.

    For info, the problem formula is:
    =IF(N4:S4="overdue","Overdue","ok")

    Where the queried cells (N4:S4) contain variations of the following:
    =IF(AG4<N2+22,"overdue",AG4-21)

    AG4 is a specified date, and N2 is today's date.

    Many thanks for your time.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    An extract from the help menu, this may be the cause

    Microsoft Excel cannot translate the text into the correct data type. Make sure the formula or function is correct for the required operand or argument, and that the cells that are referenced by the formula contain valid values. For example, if cell A5 contains a number and cell A6 contains the text "Not available", the formula =A5+A6 will return the error #VALUE!.
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    12-07-2007
    MS-Off Ver
    Office Pro 2000 & 2007
    Posts
    26
    Thanks for the reply

    The formula works fine if it's in one of the queried columns (ie. N:S), but if I move it to a different column it returns the #VALUE!
    I have made sure that the correct cell ref's have been carried over when the problem occurs, and also that the cell format is the same, which is why I can't understand why it only works in certain columns.

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Is it possible to drop a sample with the problem, so that we can try and find it?

    To post a zipped example, go to “My Documents” or wherever you have your file stored, right-click and “Send to > Compressed file”, then attach this zipped file to your post.

  5. #5
    Registered User
    Join Date
    12-07-2007
    MS-Off Ver
    Office Pro 2000 & 2007
    Posts
    26
    Hopefully the sheet should be attached.

    Thanks for your time!
    Attached Files Attached Files

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Using relative referenced would help.
    But if you are dragging that formula along a row,

    =(N4="overdue","overdue","OK") is another formulation.

  7. #7
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Quote Originally Posted by BBS
    Hopefully the sheet should be attached.

    Thanks for your time!
    Shouldn't the query be something like this in N7, then drag along to S7

    =IF(N4>$N$2,"ok","overdue")

  8. #8
    Registered User
    Join Date
    12-07-2007
    MS-Off Ver
    Office Pro 2000 & 2007
    Posts
    26
    Sorry, think I may have confused the issue by not removing the test cells.

    The formula I'm having issues with is working correctly in O2. When I try to move this formula into cell A4 (which is where it's req'd) it returns #value!
    (The formula only returns the expected answer when placed in columns N:S)

    I'll attempt to explain what I'm trying to achieve, without draining you of the will to live:

    We have a delivery date, which we need to reference to highlight when information is required (ie. 3 weeks before delivery).
    The result needs to show either the date the information is requierd by, or "overdue" depending on todays date.
    We then need to check the result of this series of cells to determine whether any of them are overdue, which is the problem formula.

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    The formula you are using only looks at N4, not the whole range unless you confirm it with CTRL+SHIFT+ENTER....and it still won't give the correct result.

    =IF(OR(N4:S4="overdue"),"overdue","ok") confirmed with CSE keys will give correct result or...

    Try:

    =IF(ISNUMBER(SEARCH("overdue",$N$4:$S$4)),"Overdue","ok") instead (doesn't need CSE key confirmation)
    Last edited by NBVC; 12-07-2007 at 11:13 AM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  10. #10
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Quote Originally Posted by NBVC
    Try:

    =IF(ISNUMBER(SEARCH("overdue",$N$4:$S$4)),"Overdue","ok") instead (doesn't need CSE key confirmation)
    I think you meant MATCH there Vittorio


    =IF(ISNUMBER(MATCH("overdue",$N$4:$S$4,0)),"Overdue","ok")

    Richard

  11. #11
    Registered User
    Join Date
    12-07-2007
    MS-Off Ver
    Office Pro 2000 & 2007
    Posts
    26
    Hi

    Thanks for the answers

    I've just tried both, the =IF(OR(N4:S4="overdue"),"overdue","ok") formula seems to work perfectly
    The =IF(ISNUMBER(SEARCH("overdue",$N$4:$S$4)),"Overdue ","ok") seems to be returning false unless all queried cells are true, whereas I need it to return true unless all are false.

    Thanks again, I can finally remove my head from the desk and try to get something done!!!

    Just seen "Match" post, works a treat!

    Thanks to all!
    Last edited by BBS; 12-07-2007 at 11:52 AM.

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    ...oops... sorry about that.... Richard kindly found my fault and suggested a better alternative (thanks Richard)....

    You could use the Isnumber(search combo too, but you would need to add an Or() around it and confirm it with CSE keys.

    Please Login or Register  to view this content.
    confirmed with CTRL+Shift+Enter would work.... but Richard's version needs no special confirmation...just Enter....

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1