+ Reply to Thread
Results 1 to 20 of 20

Increment Decrement Lat long Coordinate

  1. #1
    Registered User
    Join Date
    12-01-2020
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    26

    Increment Decrement Lat long Coordinate

    Hello to everyone, I have latitude and longitude coordinate. This is in degrees minutes format, I have to decrease 15 minutes in latitude coordinate and increase 15 minutes in longitude coordinate. I need the code in the vba function ex."Function Convert_Latitude(Lat As String) As Double" "Function Convert_Longitude(Long As String) As Double"
    If you help me, I will be grateful to you.
    Last edited by angelinabrown0123; 12-19-2020 at 12:26 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Increment Decrement Lat long Coordinate

    Do the functions Convert_Latitude and Convert_Longitude already exist or are you looking to create them?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-01-2020
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    26

    Re: Increment Decrement Lat long Coordinate

    vba function actually does not exist, I have shown it to be created like this

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,871

    Re: Increment Decrement Lat long Coordinate

    The main problem I see is that all of your inputs and outputs are text. So your overall procedure needs to parse the text string into a meaningful number, perform the calculation, then convert back to a text string. Perhaps it is just my own bias, but I hate converting numbers to text, so I try to avoid that as much as possible.

    What is absolutely required here and what can we do differently? Are you required to store the coordinates as text strings in this format, or are you allowed to find other ways to store these? Are you required to use VBA, or would a worksheet formula solution be acceptable?

    Here's how I would probably do this (which is not exactly what you show, but I find it easier):

    1) Store numbers as degree.decimal minute numbers. 16.45 -- 80.45 and 15.23456 -- 79.45321 and so on.
    2) Use the DOLLARDE() function to convert these to decimal degrees DOLLARDE(A3,60)
    3) Perform the addition/subtraction latitude -- DOLLARDE(...)-0.25 longitude DOLLARDE(...)+0.25.
    4) Convert back to degree.decimal minute numbers using the DOLLARFR() function. In D3 =DOLLARFR(DOLLARDE(...)-0.25,60). In E3 =DOLLARFR(DOLLARDE(...)+0.25,60). Copy/paste/fill down.

    Would something like that be allowed?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Increment Decrement Lat long Coordinate

    If you search you'll find plenty of functions that convert between degrees latitude/longitude and decimal latitude/longitude.

    The only issue is that you'll have to find functions that will work with the format you are using for degrees.

  6. #6
    Registered User
    Join Date
    12-01-2020
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    26

    Re: Increment Decrement Lat long Coordinate

    MrShorty, This would be possible with vba, so it would be good because I don't like to calculate in many rows, if it is difficult by vba then I would not mind the formula either. And I also tried using the given =DOLLARFR function but it is not responding correctly every time, maybe I made a mistake in calculating..

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,871

    Re: Increment Decrement Lat long Coordinate

    I also tried using the given =DOLLARFR function but it is not responding correctly every time,
    It is difficult to debug without knowing exactly what you tried. My guess is that some of the input values were not entered correctly, but there's no way to know without knowing exactly what you tried.

    I'm not sure I understand the preference for VBA. If you can enter the data as degree.decimal minute like I suggested, the same sequence can be executed in VBA by calling the Excel functions from VBA, but I don't see what advantage the VBA function would provide in this case.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Increment Decrement Lat long Coordinate

    Unorthodox method perhaps?
    Please Login or Register  to view this content.
    Last edited by sintek; 12-20-2020 at 04:54 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  9. #9
    Registered User
    Join Date
    12-01-2020
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    26

    Re: Increment Decrement Lat long Coordinate

    Yes this is what i was looking for but it is possible in vba (formula) function

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Increment Decrement Lat long Coordinate

    It is in VBA ...
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  11. #11
    Registered User
    Join Date
    12-01-2020
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    26
    Quote Originally Posted by AliGW View Post
    It is in VBA ...
    I had cleared in the first post that this answer may be necessary in the vba formula, There is no reason to be confused, you may not have understood me or you have not read the first post.,
    Although I like the effort of MrShorty and sintek.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Increment Decrement Lat long Coordinate

    There is one very good reason to be confused, and that is that you have posted in the VBA section. If you don't want a VBA solution, then that is your mistake!

    Would you like me to move the thread to the correct forum section for you?

  13. #13
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Increment Decrement Lat long Coordinate

    Yes this is what i was looking for but it is possible in vba (formula) function
    UDF ?

    Please Login or Register  to view this content.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Copy down and across
    Last edited by sintek; 12-20-2020 at 05:34 AM.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Increment Decrement Lat long Coordinate

    I think the OP wants a formula, but posted in the wrong area. Let's wait for a response to post #12.

  15. #15
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Increment Decrement Lat long Coordinate

    Quote Originally Posted by AliGW View Post
    I think the OP wants a formula, but posted in the wrong area. Let's wait for a response to post #12.
    No formula options available...As data is text...

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Increment Decrement Lat long Coordinate

    Could we all please wait now until the OP has responded to my post #12? Thanks.

    No formula options available...As data is text...
    Not true ... It is possible.
    Last edited by AliGW; 12-20-2020 at 05:51 AM.

  17. #17
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Increment Decrement Lat long Coordinate

    Okay, cool...Formulas not my forte...
    I need the code in the vba function ex."Function Convert_Latitude(Lat As String) As Double" "Function Convert_Longitude(Long As String) As Double"
    Assumed this is UDF?
    Last edited by sintek; 12-20-2020 at 06:00 AM.

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Increment Decrement Lat long Coordinate

    @Sintek - see posts #9 and #11.

    I have very clearly requested that you do NOT post again to this thread until the OP has responded to my post #12. Please do not ignore this request!

    I have a potential formula solution ready, if required.
    Last edited by AliGW; 12-20-2020 at 06:40 AM.

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Increment Decrement Lat long Coordinate

    All Participants:

    Please do not post a reply in a thread where a Moderator or Administrator has requested an action that has not yet been complied with (in this case, a response to post #12). Thanks.

  20. #20
    Registered User
    Join Date
    12-01-2020
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    26

    Re: Increment Decrement Lat long Coordinate

    I apologize for the late reply, I tried your function, it's absolutely accurate, I wanted it, thank you for your effort.

+ 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. Recursive Increment/Decrement Until Column Total = Expected Total
    By krissysteen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-30-2019, 01:21 AM
  2. [SOLVED] formula to increment 4 and decrement 4
    By dude6571 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-11-2018, 04:27 PM
  3. [SOLVED] Increment/Decrement a spin button by less than 1
    By ysdai7287 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2017, 10:20 PM
  4. increment/decrement a date with spinner
    By excelinator in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2010, 03:17 AM
  5. How to increment / decrement rows / columns ?
    By naveenvarthaan in forum Excel General
    Replies: 1
    Last Post: 09-01-2009, 08:40 AM
  6. cell math to decrement/increment a cell
    By BUFFETT in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-16-2006, 03:45 PM
  7. How do I increment or decrement values in a column?
    By OldKenGoat in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 01-05-2005, 09:06 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