+ Reply to Thread
Results 1 to 12 of 12

A value used in the formula is of the wrong data type.

  1. #1
    Registered User
    Join Date
    06-11-2014
    Posts
    10

    A value used in the formula is of the wrong data type.

    I am trying to get a IF statement to work for me and I have tried various ways to get it to work and still no joy. Hopefully I can get a little assistance here and set me straight.

    =IF(mvr_Sheet!$M$4:$M$43 < bv_Sheet!$M$4:$M$43, Yes, No)

    The spaces between the < have been removed to allow me to post this code.

    I would appreciate any help!!

    Terry

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: A value used in the formula is of the wrong data type.

    Try it now
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Registered User
    Join Date
    06-11-2014
    Posts
    10

    Re: A value used in the formula is of the wrong data type.

    Quote Originally Posted by AlKey View Post
    Try it now
    Please Login or Register  to view this content.
    I was hoping but no joy, Still comes back with #VALUE and the same error stated in the title.

    Thanks for giving it a shot though.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: A value used in the formula is of the wrong data type.

    Can you explain what you are hoping that the formula will do?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    06-11-2014
    Posts
    10

    Re: A value used in the formula is of the wrong data type.

    Basically compare the numbers in $M$4:$M$43 in both sheets and if the first sheet is lower then the second sheet return Yes and if higher then return No.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: A value used in the formula is of the wrong data type.

    Post removed by GK

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: A value used in the formula is of the wrong data type.

    I'm not 100% clear what you want....

    This array formula compares two columns, row-by-row, and returns "Yes" if, for each row, column A is less than column B.

    =IF(COUNT(A1:A6)=SUM(IF(A1:A6-B1:B6<0,1,0)),"Yes","No")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...

    However, change cell B3 to 4. It's still higher than A3 (3), but 4 is less than some of the values in column A. In this circumstance, what do you want the formula to do?
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-11-2014
    Posts
    10

    Re: A value used in the formula is of the wrong data type.

    Ok not sure I am going to make much sense here but I am hoping to get a formula that will check every row in column M on both sheets and if any number in a cell of column M on mvr_sheet is less then any cell of column M on bv_sheet then return Yes.

    Don't know if that made it any clearer but it is difficult to explain things when you don't know exactly what formula one would use to arrive at the solution.

    I am not trying to be difficult just don't know what you know.

    Glenn Kennedy,

    Looks like your solution addressed the issue, Question though is why wouldn't the way I was originally trying work? It seems you can't use $ in an IF statement as it returns #VALUE but even removing the $ it still had issues. Yeah I know the explanation may take a bit of typing so if you could point me in the right direction as for the explanation I would surely appreciate it.

    Thanks for taking the time to assist me.
    Last edited by Montana2014; 02-25-2017 at 12:52 AM.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: A value used in the formula is of the wrong data type.

    I'm on a bus... no PC only phone. You'll have to adapt this to suit:

    =IF (MIN (cell range 1)< = MAX (cell range 2),"Yes","No")

  10. #10
    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
    52,939

    Re: A value used in the formula is of the wrong data type.

    You cannot test a range like that....
    =IF(mvr_Sheet!$M$4:$M$43 < bv_Sheet!$M$4:$M$43, Yes, No)

    Basically compare the numbers in $M$4:$M$43 in both sheets and if the first sheet is lower then the second sheet return Yes and if higher then return No.
    what if some are lower and some are higher?

    I suggest that you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    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

  11. #11
    Registered User
    Join Date
    06-11-2014
    Posts
    10

    Re: A value used in the formula is of the wrong data type.

    Quote Originally Posted by Glenn Kennedy View Post
    I'm on a bus... no PC only phone. You'll have to adapt this to suit:

    =IF (MIN (cell range 1)< = MAX (cell range 2),"Yes","No")
    Thanks Glenn!!

    Both solutions worked fine but I opted for the last one you recommended.

  12. #12
    Registered User
    Join Date
    06-11-2014
    Posts
    10

    Re: A value used in the formula is of the wrong data type.

    Quote Originally Posted by FDibbins View Post
    You cannot test a range like that....
    =IF(mvr_Sheet!$M$4:$M$43 < bv_Sheet!$M$4:$M$43, Yes, No)


    what if some are lower and some are higher?

    I suggest that you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    Yes I figured that out by trying several different ways of making it work and failing at each try.

    Glenn stepped in and set me straight so I am good to go.

+ 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. [SOLVED] Error in Vlookup string: A value used in the formula is of the wrong data type.
    By Taylorim in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-20-2016, 08:20 AM
  2. [SOLVED] Wrong Data Type Value Are for formula involving Dates
    By heresteve2 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-17-2014, 12:38 PM
  3. Value used in formula of wrong data type
    By masry6683 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2014, 10:55 AM
  4. SUMIFS Problem - A value used in the formula is of the wrong data type
    By TicklyTigger in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-09-2014, 10:48 AM
  5. [SOLVED] VBA replacing a formula with a macro returns #Value (Wrong data type)
    By silent3486 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-14-2013, 04:17 PM
  6. Replies: 4
    Last Post: 04-20-2012, 08:44 AM
  7. Formula returns wrong data type
    By mbrown89 in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 01-30-2010, 12:36 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