+ Reply to Thread
Results 1 to 8 of 8

Excel 2007 : Formula not working and cant see what is wrong

  1. #1
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    Formula not working and cant see what is wrong

    Hi Guys,

    After some help understanding what i have done wrong with this formula.

    =IF(H30>Z62,VLOOKUP(AK60,oddsSods!J2:K21,2,TRUE),VLOOKUP(AK60,[Data.xlsx]code34!A2:B35,2,TRUE))

    There seems to be a conflict with the greater than part of the formula. So if greater than; use the first lookup else use the second look up. Every time it uses the second lookup.

    Any help much appreciated

    DvDj
    Last edited by DvDj; 02-10-2009 at 10:41 AM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Formula not working and cant see what is wrong

    Are h30 and z62 numbers ?
    If so, are they real numbers or text looking like numbers ? ( in the latter case they are left-aligned if no formatting is applied)

  3. #3
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    Re: Formula not working and cant see what is wrong

    Hi Arthurbr,

    Both cells are formatted as numbers with no decimal places and aligned right

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Formula not working and cant see what is wrong

    Continuing Arthur's point... what happens if you replace:

    =IF(H30>Z62

    with

    =IF(N(H30)>N(Z62),

    (point being formatting a number does not alter it's underlying type... so if it was a text value, formatting to number has 0 impact... it must be coerced to numeric type)

  5. #5
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    Re: Formula not working and cant see what is wrong

    DonkeyOte,

    Many thanks for your help i have tried it and in every case it now only refers to the first look up and now ignors the second!!!

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Formula not working and cant see what is wrong

    I suggest you post a sample of the file with appropriate values in H30 and Z62 such that we can review.... presumably your file is on auto-calculation ?

  7. #7
    Registered User
    Join Date
    10-15-2008
    Location
    Surbiton
    MS-Off Ver
    Office 365 business
    Posts
    42

    Re: Formula not working and cant see what is wrong

    Thank you everyone for helping me with the above issue.

    I wasnt able to post an example due to the sensitivity of the data and every time i mocked up a working example the formula worked!!

    I have finally however now got to the bottom of it. It turns out that it couldn't work out which value was larger because the data (from another spreadsheet) used to populate the cells were formatted as text. So the original document data was text and in the final spreadsheet that was using this data, although formatted to general couldn't recognise it as anything other than text, so failing the formula.

    Reformatted the original data and it all works fine now.

    Again many thanks for your help and support.

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Formula not working and cant see what is wrong

    My bad in hindsight... this:

    =IF(N(H30)>N(Z62),

    should in fact have been

    =IF(VALUE(H30)>VALUE(Z62),

    at which point it would have worked but revising the underlying data is best when possible

+ 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