+ Reply to Thread
Results 1 to 5 of 5

Logic Formula to calculate distance

  1. #1
    Registered User
    Join Date
    07-01-2009
    Location
    Durham
    MS-Off Ver
    Excel 2003
    Posts
    15

    Question Logic Formula to calculate distance

    Hey all, I am a bit stuck on a project I am doing. I have a excel sheet with city names in Column A, Distances in Column B, and Distances in Column C.

    I wanted to write a formula so excel checks the distance between column C and column B and if there is less than a 10% difference between the two then it would copy the name of that city into another column D.

    Any help would be greatly appreciated, thanks!
    Last edited by xury2000; 07-07-2009 at 02:16 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Logic Formula to calculate distance

    You mean something like:

    =IF((C2-B2)/80<0.1,A2,"")
    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.

  3. #3
    Registered User
    Join Date
    07-01-2009
    Location
    Durham
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Logic Formula to calculate distance

    Quote Originally Posted by NBVC View Post
    You mean something like:

    =IF((C2-B2)/80<0.1,A2,"")
    I tried that formula but the problem is that instead of just checking 1 cell minus the other cell, it needs to check the entire Column C minus entire Column C and if it fits then 10% criteria only then does it Copy the city name.

    I tried to modify your formula into:

    =IF((C20:C4896-B13)/B13<0.1,A20:A4896,"")

    B13 is a static value that I have

    However excel gave me an value error.

    Also on a related value, is there anyway for excel to check for the second least value instead of the MIN value in a list of values?

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Logic Formula to calculate distance

    The formula that NBVC gave you needs to be copied down Column D. In each row, it will copy over the name of the city if it meets your criteria.
    Also, I'm not sure what you have in B13, but if it's relevent to the formula, you need to make it absolute ($B$13) before dragging the formula down so it doesnt change.

    In reference to your second smallest number, if your list is in B2:B500,
    Please Login or Register  to view this content.
    where the 2 indicates second smallest number.
    Any of that help?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Logic Formula to calculate distance

    Quote Originally Posted by ChemistB View Post
    Also, I'm not sure what you have in B13, but if it's relevent to the formula, you need to make it absolute ($B$13) before dragging the formula down so it doesnt change.
    That was my mistake... I was using the hard entered values...should be

    =IF((C2-B2)/C2<0.1,A2,"")

    copied down...

+ 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