+ Reply to Thread
Results 1 to 3 of 3

If/then formula needed for two different variables, needs to be consistant

  1. #1
    Forum Contributor
    Join Date
    03-14-2005
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    172

    If/then formula needed for two different variables, needs to be consistant

    Hi I'm trying to compare two numbers with an if/then formula. the problem I'm having is that the formula needs to be changed each time because sometimes it's 3 numbers and sometimes it's 2 numbers. Is there a way to have a consistent formula without need to change. Please see attached sheet. Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: If/then formula needed for two different variables, needs to be consistant

    Hi Mile,

    Perhaps this will work for you?

    =IF(LEFT(B1,FIND(".",B1)-1)+0=VALUE(A1),"YES","NO")

    This function finds the first "." in the string in B1 and returns everything to the left of it. It then adds 0 to this string to convert it to an actual number. It then takes that number and compares it to the value of the numeric string in A1. If they match you'll see YES, otherwise NO.

  3. #3
    Forum Contributor
    Join Date
    03-14-2005
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    172

    Re: If/then formula needed for two different variables, needs to be consistant

    Okay, first off thank you, works beautifully!
    Secondly I didn't know of the "FIND" formula, good to know and will use in the future
    Lastly, you are very good, I broke down each piece of the formula to see how it's comparing, very nice work. Thanks again.

+ 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