Closed Thread
Results 1 to 6 of 6

loop in excel--need help..

  1. #1
    Registered User
    Join Date
    02-18-2010
    Location
    pune,india
    MS-Off Ver
    Excel 2003
    Posts
    2

    loop in excel--need help..

    hai all,

    i have to find the distance between two points whose coordinates are given...

    i can found out by using the basic distance formula in excel ....but problem here is when iam given with some 3 points....i can go with 1&2 and then 2&3 sequentially...but how to find for 3 & 1 in the same order.....

    i dnt want to put once again formul;a for 3 & 1...

    becoz iam working with ny one of my project where i need to increase the no. of points...so if no. of points increases.....i cannot use the same formula as the third distance will refer 3 and 1,,,,

    for better understandig...c

    1-2,2-3,3-4,4-5, & 5-1......

    pls help....any help greatly appreciated

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: loop in excel--need help..

    Please read the forum rules
    1) Your title does not explain your problem.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Registered User
    Join Date
    02-16-2010
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: loop in excel--need help..

    Quote Originally Posted by raffiq View Post
    hai all,

    i have to find the distance between two points whose coordinates are given...

    i can found out by using the basic distance formula in excel ....but problem here is when iam given with some 3 points....i can go with 1&2 and then 2&3 sequentially...but how to find for 3 & 1 in the same order.....

    i dnt want to put once again formul;a for 3 & 1...

    becoz iam working with ny one of my project where i need to increase the no. of points...so if no. of points increases.....i cannot use the same formula as the third distance will refer 3 and 1,,,,

    for better understandig...c

    1-2,2-3,3-4,4-5, & 5-1......

    pls help....any help greatly appreciated
    Not entirely sure I have your question right, but I would guess that your loop counter will run from 1 to n where teh value of the counter is the first point to measure from, and you can stick an If statement in your loop that says if loopcounter is less than n then second point is loopcounter+1 else second point is 1?
    Last edited by WaveOfMutilation; 02-18-2010 at 05:39 AM. Reason: extra n

  4. #4
    Registered User
    Join Date
    02-18-2010
    Location
    pune,india
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: loop in excel--need help..

    iam giving my problem here for clear understanding..

    i have 3 columns.

    1st column my center no. 2nd column x coordinate and 3rd column y coordinate...


    now i have to find the centre distance between 1&2 ,2& 3 and 3 &1.

    is there any way that when i increase the no of centres and still i can give me the distances by taking the last no and the first no....


    i have attached the excel file for reference.....
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-16-2010
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: loop in excel--need help..

    No programming needed here. Attached has amended formula. As long as you insert rows below the current data when you add centres you should be able to just drag down the formula.
    Attached Files Attached Files

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: loop in excel--need help..

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

Closed Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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