+ Reply to Thread
Results 1 to 34 of 34

How do I correct my formula to place the leading zero at the end of my naming (cross post)

  1. #1
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Exclamation How do I correct my formula to place the leading zero at the end of my naming (cross post)

    Hi all. Seems like my post on another forum made more than 30 hours ago has been buried under the bush, just want bump it up here.

    I can't link the post as I;m a new user. So just breaking it up.
    www . mrexcel . com/board/threads/what-am-i-missing-in-my-formula-for-adding-leading-zeroes-to-my-list.1156323

    Thanks,
    Sam
    Last edited by Sampoline; 12-19-2020 at 06:43 AM. Reason: On request

  2. #2
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Can someone help me fix my formula? (crosspost; link in the message description)

    OK, but you will need to tell us what the problem is that you wish to solve. This is a different forum: nobody is going to go to another forum to find out what the issue is. If you are just expecting people to go over there and help you there, then I am afraid that's not allowed, so please give ddetails of the issue here. Thanks.
    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.

  3. #3
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Can someone help me fix my formula? (crosspost; link in the message description)

    Administrative Note:

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

  4. #4
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How to fix my formula to portray the correct leading zeroes in the name (crosspost)

    Hi sorry I'm new. I was told when cross posting not to create the question anew on a different forum, so that's why I just added the link. Seems like I misunderstood. Anyway I'll begin my question from the start as per your request.

    I'm having an issue with a formula I have for adding a leading zero to the end of all my cells. I have attached a workbook. Please review it.

    Column B has the formula I have so far. Which is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    But this isn't correct entirely. In the workbook, the mistakes in Column B are highlighted in red. Column C has the correct naming. But they are just values, how can fix my formula to reflect the values in Column C. (I don't want the 3rd column, I want to fix Column B).

    I'm a bit lost.

    Thanks,
    Sam
    Attached Files Attached Files

  5. #5
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Can someone help me fix my formula? (crosspost; link in the message description)

    See post #3 - update your title to something explicit of your problem, please, and then I'll have a look. Thanks.

  6. #6
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: Can someone help me fix my formula? (crosspost; link in the message description)

    Sorry. The title has been updated. Is this okay now?

  7. #7
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Yes - I am looking at it now.

  8. #8
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    This works on your small data sample:

    =TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(A2,"/","-"),"-"," ",3),10))&"-"&IFERROR(TEXT(VALUE(TRIM(RIGHT(SUBSTITUTE(RIGHT(A2,4),"/",REPT(" ",10)),5))),"00"),RIGHT("0"&TRIM(RIGHT(SUBSTITUTE(RIGHT(A2,4),"/",REPT(" ",10)),5)),3))

  9. #9
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Just spotted an issue with it - sorry. Will have another look.

  10. #10
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    No problem, thanks for looking into it.

  11. #11
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    A bit of brain freeze - I think I'm going to look at a different approach. Look in again later!

  12. #12
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Yeah it's got me in a bit of a head spin the past couple of days!

  13. #13
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    OK, so this is a PowerQuery solution (you can download the add-in from here:https://www.microsoft.com/en-gb/down....aspx?id=39379), which is an integral part of Excel 2016 and above.

    M Code:

    Please Login or Register  to view this content.
    Excel 2016 (Windows) 32 bit
    F
    1
    AliGW
    2
    A-VG-Z1-01
    3
    A-VG-Z1-02b
    4
    A-VG-Z1-03.1
    5
    A-VG-Z1a-04
    6
    A-VG-Z1a-05
    7
    A-VG-Z1a-06
    8
    A-VG-Z1a-07
    9
    A-VG-Z1-08
    10
    A-VG-Z1-09
    11
    A-VG-Z1-10a
    12
    A-VG-Z1-11
    Sheet: Sheet1
    Attached Files Attached Files
    Last edited by AliGW; 12-19-2020 at 08:35 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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    I just updated post #13.

  15. #15
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Hi Ali,

    Thanks for so much for this. You've saved me so much headache over the last couple of days honestly. So this is the first time I have ever dealt with Power Queries. Will this work fine with Excel 2013 too? I'm at home at the moment so I'm using 365. But at work they use 2013. Will need to adjust the query to that particular spreadsheet. Just want to double-check that it will be fine?

    Thanks,
    Sam

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    This I cannot answer, as I don't have Excel 2013. As long as they will allow the add-in, it should work - I don't think that any of the steps I've used won't work in an older version - but you'd have to try it.

    Maybe someone with Excel 2013 who sees this could try it for us and let us know. If not, you'll have to wait and see. Sorry!

  17. #17
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Hi Ali,

    Yep I will have to check back on Monday when I get into the office to make sure it works. But I can confirm to you right now that Power Query is 100% available as an add-in on Excel 2013. Just never used it for any of my work.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Right - I know that, but sometimes companies won't install add-ins, and that's what I was querying. If you know they'll install it for you at work, then we're halfway there.

  19. #19
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Awesome thanks for asking about that. I will confirm all this soon!

    In the meantime, I've been looking at the M code to understand what all of it means. I am having a bit of difficulty understanding what's going in there as newbie. Now if I have to bring this power query over to my custom spreadsheet at work; seems a little daunting for me. As I have different column names. I'm assuming if column names are different, I'm changing the text in red to the appropriate name. But I'm not able to get my head around for example:

    Please Login or Register  to view this content.
    What does Current Name.1 and Current Name.2.2 represent exactly? What is different between the two Current Name(s)?

    In understanding that, say there comes a point where I have a name that is like "A/VG/Z1/7.1.1" how would I have to adjust the m code to account for the extra ".1" at the end? If that makes sense.

    Thanks for your patience.

  20. #20
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    OK - I think the thing to do is to step through the steps rather than looking at the code itself: everything I did can be done using UI clicks. You can do this by clicking sequentially from top to bottom on the stages to the right and looking at what happens in the UI.

    Queries are easy to adapt once you know what they are doing.

    I can write a step-by-step if you wish, but it would take me quite a while!

    In understanding that, say there comes a point where I have a name that is like "A/VG/Z1/7.1.1" how would I have to adjust the m code to account for the extra ".1" at the end? If that makes sense.
    That's called a spanner in the works! You really should have thought about this scenario when you posted the sample data. Back to the drawing board!
    Last edited by AliGW; 12-19-2020 at 11:22 AM.

  21. #21
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    OK - here's a new version that should allow for the different levels at the end of the code.

    M Code:

    Please Login or Register  to view this content.

    Excel 2016 (Windows) 32 bit
    F
    1
    Merged
    2
    A-VG-Z1-01
    3
    A-VG-Z1-02b
    4
    A-VG-Z1-03.1
    5
    A-VG-Z1a-04
    6
    A-VG-Z1a-05
    7
    A-VG-Z1a-06
    8
    A-VG-Z1a-07
    9
    A-VG-Z1-08
    10
    A-VG-Z1-09
    11
    A-VG-Z1-10a
    12
    A-VG-Z1-11
    13
    A-VG-Z1-07.1.1
    Sheet: Sheet1
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Thanks for your help Ali. I'm starting to understand this. Will report back tomorrow when I get it done on my work spreadsheet!

  23. #23
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Great! There will probably be workarounds if any of the steps fail in the older add-in, so just shout.

  24. #24
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Hi Ali,

    I've just tried opening up your spreadsheet on Excel 2013 and ran into the following error at 'Step 9'.

    Attachment 709707

    Previous steps are showing up fine it seems..

  25. #25
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    The attachment is invalid, so I can’t see it. Tell me what the error is.

  26. #26
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    The error is as follows:

    Expression.Error: The name 'Splitter.SplitTextByCharacterTransition' wasn't recognized. Make sure it's spelled correctly.

    The Applied Step was 'Split Column by Character Transition':
    = Table.SplitColumn(#"Added Prefix", "Current Name.2.1", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"Current Name.2.1.1", "Current Name.2.1.2"})

  27. #27
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    OK - I thought that might be the one to trip it up. Leave it with me and I'll try to create a workaround for that step. Will report back later.

  28. #28
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Thankyou so much!

  29. #29
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Try this version.
    Attached Files Attached Files

  30. #30
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,458

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    A formula solution:

    Please Login or Register  to view this content.
    Quang PT

  31. #31
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  32. #32
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Having spent a significant amount of time helping you with this, I am keen to know whether my latest version has worked for you - some feedback would be appreciated.

  33. #33
    Registered User
    Join Date
    12-06-2020
    Location
    Sydney, Australia
    MS-Off Ver
    2013
    Posts
    22

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    Hi Ali

    Sorry for the delayed response, I was feeling unwell the last couple of days so was away from the computer.

    I've just had a look at the spreadsheet and this finally works! The table is loading and refreshing with no errors! Thank you so much for being patient and working hard. Saved me from further headache here.

    Glad to meet you.

    Thanks,
    Sam

  34. #34
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: How do I correct my formula to place the leading zero at the end of my naming (cross p

    That’s great. Please see post #31 fir instructions how to sign off the thread.

+ 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. Macro that pastes a formula in a dynamic range of cells [crosspost]
    By eljn0323 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2020, 03:33 PM
  2. [SOLVED] URL link in message box
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2017, 03:04 AM
  3. Pop up message and go to link
    By Anisusa in forum Excel General
    Replies: 7
    Last Post: 01-04-2017, 10:04 AM
  4. [SOLVED] Drop List with a description but once chosen description disappear
    By dezspert22 in forum Excel General
    Replies: 22
    Last Post: 12-19-2016, 05:24 PM
  5. link pop-up message to a cell
    By ash369ster in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2015, 07:49 AM
  6. [SOLVED] How to pop up a warning message before any Excel automatic update link reminder message
    By billj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2013, 10:41 AM
  7. How to get rid of an link message in Excel?
    By Jenny in forum Excel General
    Replies: 4
    Last Post: 07-14-2005, 12:05 PM

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