+ Reply to Thread
Results 1 to 17 of 17

#VALUE error with IsNumber and IsFormula

  1. #1
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    #VALUE error with IsNumber and IsFormula

    I have the following formula in one column (W) in a big data base. It works fine but when rows
    are inserted for subtotals or whatever all the formulas return a #VALUE error wrong data type!
    If you select the cell and hit F2 edit and return it corrects itself. I replaced IsFormula with IsNumber
    for a test with same results.


    =IF(IsFormula(V4),V4*E4,V4*Crew1_Labor_Pct)

    Any thoughts?

    ThanksTom

  2. #2
    Forum Contributor
    Join Date
    09-30-2013
    Location
    Toronto, ON
    MS-Off Ver
    Excel 2007
    Posts
    229

    Re: #VALUE error with IsNumber and IsFormula

    I think we need to see what the data is like to really be able to debug it.
    Can you post the spreadsheet?

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,951

    Re: #VALUE error with IsNumber and IsFormula

    What does Crew1_Labor_Pct pertain to? Is it a named range? i.e. one cell with a value in?

    As hectop states, probably best if we could see the data. Anonymise it if it contains anything sensitive.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: #VALUE error with IsNumber and IsFormula

    I have 2007, which does not have a =IsFormula() function, so I am unsure if 2010 has that function.

    However, if that is a direct copy from the cell you have it in...
    =IF(IsFormula(V4),V4*E4,V4*Crew1_Labor_Pct)
    then it looks like that is not a function in 2010 either, else the "IsFormula" would be all in caps "ISFORMULA"

    Also, check to see what the contents of V4 is, an error there will give an error in the formulas
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,951

    Re: #VALUE error with IsNumber and IsFormula

    Quote Originally Posted by FDibbins View Post
    I have 2007, which does not have a =IsFormula() function, so I am unsure if 2010 has that function.
    No =ISFORMULA() in my copy of Excel 2010...

  6. #6
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: #VALUE error with IsNumber and IsFormula

    >>I have 2007, which does not have a =IsFormula() function, so I am unsure if 2010 has that function.

    No it doesn't so I made my own function (actually found on web) as follows

    Function IsFormula(MyRange As Range) As Boolean
    IsFormula = False
    If MyRange.HasFormula Then IsFormula = True
    'Application.Volatile True I commented this out trying to debug, not sure what it does
    End Function

    I went back to my spreadsheet and replaced IsFormula() with ISNUMBER() and the problem disappeared!!

    I believe my IsFormula is at fault?

  7. #7
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: #VALUE error with IsNumber and IsFormula

    >>I have 2007, which does not have a =IsFormula() function, so I am unsure if 2010 has that function.

    No it doesn't so I made my own function (actually found on web) as follows

    Function IsFormula(MyRange As Range) As Boolean
    IsFormula = False
    If MyRange.HasFormula Then IsFormula = True
    'Application.Volatile True I commented this out trying to debug, not sure what it does
    End Function

    I went back to my spreadsheet and replaced IsFormula() with ISNUMBER() and the problem disappeared!!

    I believe my IsFormula is at fault?

    TRIED AGAIN with the following vba function

    Function CELLHASFORMULA(cell) As Boolean
    CELLHASFORMULA = cell.HasFormula
    End Function

    Same #VALUE error when rows inserted

    Using EXCEL'S ISNUMBER function in the formula creates no #VALUE error

    Will change logic to use Excel's function. User functions prone to internal addressing errors???

    THANKS to everyone who responded. I am new and will try to improve my posting skills

    TOM

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: #VALUE error with IsNumber and IsFormula

    i cannot reproduce that error if i use the same code.i can insert rows columns above/below/in between just fine (2007)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  9. #9
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: #VALUE error with IsNumber and IsFormula

    Martin

    OK trying to attach spread sheet to show error (newbie sorry)

    Columns W and AD have the formula with the CELLHASFORMULA user function

    Function CELLHASFORMULA(cell) As Boolean
    CELLHASFORMULA = cell.HasFormula
    End Function

    Thanks
    Last edited by Thomas J; 11-03-2013 at 04:29 PM.

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: #VALUE error with IsNumber and IsFormula

    once i get rid of value error i can insert where are you trying to insert a row?

  11. #11
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: #VALUE error with IsNumber and IsFormula

    Insertion points are random as chosen by user. A ribbon function called "Subtotal row" under custom ribbon "lowbid"
    was used to insert rows. it is under development and only is coded for row insertion and border underling.
    this is the code I used

    Please Login or Register  to view this content.
    Thanks
    Last edited by FDibbins; 11-02-2013 at 09:23 PM. Reason: code tags added

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: #VALUE error with IsNumber and IsFormula

    Thomas, plese use code tags when posting VBA code...
    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

  13. #13
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: #VALUE error with IsNumber and IsFormula

    First of all apologies to everyone and thanks for putting up with
    a first timer. To explain my problem properly I have attach a file
    with a formula in column W that returns a #VALUE when I run Macro named "InsertSubtotal".
    The formula in column W relies on CELLHASFORMULA funtion to determine if there is a formula in the cell.
    Both of these are in Module1 in the VBA editor.

    I am trying to write code to let users insert subtotals in the columns which already have the grand totals
    So pick a row, insert two rows, border top row for an underline is all it does now.
    But when it runs I get the #VALUE error. Insert rows manually (right click row & insert)works fine??
    Also edit cell (F2) and formula corrects!!

    Thanks Again.
    Attached Files Attached Files

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: #VALUE error with IsNumber and IsFormula

    I am trying to write code to let users insert subtotals in the columns which already have the grand totals
    I know you want VBA for this, but just an FYI...If you use =subtotal() for your subtotals, you can then also use =subtotal() for the grand total - includiing the entire range (as well as all the ST's above), and it will give you the grand total excluding the subtotals above

  15. #15
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: #VALUE error with IsNumber and IsFormula

    Yes thanks for the advice. I believe the correct entry would be =subtotal(9,cell1:cell2)?

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: #VALUE error with IsNumber and IsFormula

    Yes correct, subtotal(9,range)
    OR, if you might be filtering out a few rows and want them excluded from the total, use
    subtotal(109,range)

  17. #17
    Registered User
    Join Date
    08-04-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: #VALUE error with IsNumber and IsFormula

    Problem Solved. Turned off auto calculate then turned it back on after macro inserted rows.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. cell.isNumber error
    By aloha31 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2013, 01:15 PM
  2. [SOLVED] Error with ISNUMBER Match
    By sinspawn56 in forum Excel General
    Replies: 2
    Last Post: 01-07-2013, 03:15 PM
  3. IsFormula()
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2011, 04:43 PM
  4. Elseif Not IsNumber error
    By toocold in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2007, 02:45 AM
  5. [SOLVED] isformula?
    By dave in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-27-2005, 03:10 PM

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