+ Reply to Thread
Results 1 to 24 of 24

Change the value to 2 digits

  1. #1
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Change the value to 2 digits

    Dear experts,

    I need help with a common issue,

    for example, when cell C2 contains the value 14689, then cell C3 produces 11*14*16*18*19*41*44*46*48*49*61*64*66*68*69*81*84*86*88*89*91*94*96*98*99*

    Can you help me as I have tried with Ai but it did not yield any results.

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,008

    Re: Change the value to 2 digits

    Try this in C3.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    =textjoin("*";1;makearray(len(C2);len(C2);lambda(x;y;mid(C2;x;1)&mid(C2;y;1))))

    #VALUE!
    Attached Images Attached Images

  4. #4
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,008

    Re: Change the value to 2 digits

    Input your data in C2 according to your op.

    If you want data in A1, try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    Thank you, the formula matches what I expected.

    Could you help with a few more formulas?

    For example, if C9 is filled with the value 19, then cell C10 will result in 01*09*10*11*12*13*14*15*16*17*18*19*21*29*31*39*41*49*51*59*61*69*71*79*81*89*90*91*92*93*94*95*96*97*98*99, where C10 comes from C2 which has been trimmed.
    Last edited by politono; 04-19-2024 at 05:37 AM.

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,008

    Re: Change the value to 2 digits

    Try this in C10.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    I tried to change the value in cell C2 to 0125689, the result in cell C3 is correct, but when I try to fill in cell C9 with the value 38, it produces 01*09*11*19*21*29*30*31*32*33*34*35*36*37*38*39*41*49*51*59*61*69*71*79*80*81*82*83*84*85*86*87*88*89*91*99, it should have produced 08*18*28*58*68*80*81*82*85*86*88*89*98.
    Last edited by AliGW; 04-19-2024 at 07:30 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  8. #8
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,008

    Re: Change the value to 2 digits

    I don't know what is your rule in C9.

  9. #9
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    The value of C9 is a trimmed value generated from cell C3, the value of C9 can vary according to requirements.
    reference https://katadata.org/live/index.php
    Last edited by AliGW; 04-19-2024 at 07:29 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

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

    Re: Change the value to 2 digits

    Why not this?

    =textjoin("*",1,reduce("",sequence(10,1,0),lambda(x,y,vstack(x,if(isnumber(find(y,trim(C3))),byrow(sequence(10,1,0),lambda(z,y&z)),vstack(y&"1",y&"9"))))))
    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
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    The formula needs to be placed in cell?
    Last edited by AliGW; 04-19-2024 at 07:29 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

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

    Re: Change the value to 2 digits

    Yes - its a formula, not code.

  13. #13
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    Is there a formula to trim cell C3 if it contains a value?

    For example, if C2 contains a value and results in 11*12*15*16*18*19*21*22*25*26*28*29*51*52*55*56*58*59*61*62*65*66*68*69*81*82*85*86*88*89*91*92*95*96*98*99

    Then if C9 is filled with the value 38, C10 will result in 08*18*28*58*68*80*81*82*85*86*88*89*98

    The values in cells C2 and C9 can change according to needs.
    Last edited by AliGW; 04-19-2024 at 07:50 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  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
    81,091

    Re: Change the value to 2 digits

    Yes - I have included it in the big formula:

    =TRIM(C3)

    Why don't you provide a link to your GoogleSheet so that we can see what's going on?

    Please stop quoting unnecessarily.

  15. #15
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    googlesheet
    Attached Files Attached Files

  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
    81,091

    Re: Change the value to 2 digits

    No - that's an Excel workbook.

    Provide a LINK to your GoogleSheet online.

  17. #17
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

  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
    81,091

    Re: Change the value to 2 digits

    In C3:

    =TEXTJOIN("*",1,REDUCE("",SEQUENCE(10,1,0),LAMBDA(x,y,VSTACK(x,IF(ISNUMBER(FIND(y,TRIM(C2))),BYROW(SEQUENCE(10,1,0),LAMBDA(z,y&z)),VSTACK(y&"1",y&"9"))))))

    In C10:

    =TEXTJOIN("*",1,REDUCE("",SEQUENCE(10,1,0),LAMBDA(x,y,VSTACK(x,IF(ISNUMBER(FIND(y,TRIM(C9))),BYROW(SEQUENCE(10,1,0),LAMBDA(z,y&z)),VSTACK(y&"1",y&"9"))))))

    Or copy cell C10 (CTRL+C) and paste it to C3 (CTRL+V) and the cell reference will change automatically.

    I've updated your GoogleSheet as well.
    Attached Files Attached Files

  19. #19
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,008

    Re: Change the value to 2 digits

    Try this in C10.

    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    Formula = let(a; makearray(len(C2); len(C2); lambda(x; y; mid(C2; x; 1)&mid(C2; y; 1))); textjoin("*"; 1; map(a; lambda(x; if(sum(map(arrayformula(mid(C9; sequence(len(C9)); 1)); lambda(y; --isnumber(find(y; x))))) > 0; x; "")))) ) This is correct

    Only cell C3 that is not yet correct, the value of C3 comes from cell C2.

  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
    81,091

    Re: Change the value to 2 digits

    Change ALL references. In C3:

    =let(a;makearray(len(C2);len(C2);lambda(x;y;mid(C2;x;1)&mid(C2;y;1))); textjoin("*";1;map(a;lambda(x;if(sum(map(arrayformula(mid(C2;sequence(len(C2));1));lambda(y;--isnumber(find(y;x)))))>0;x;"")))) )

    In C10:

    =let(a;makearray(len(C9);len(C9);lambda(x;y;mid(C9;x;1)&mid(C9;y;1))); textjoin("*";1;map(a;lambda(x;if(sum(map(arrayformula(mid(C9;sequence(len(C9));1));lambda(y;--isnumber(find(y;x)))))>0;x;"")))) )

    https://docs.google.com/spreadsheets...#gid=956302076

  22. #22
    Registered User
    Join Date
    01-10-2023
    Location
    Indonesia
    MS-Off Ver
    GoogleSheets Mobile
    Posts
    21

    Re: Change the value to 2 digits

    I have fixed the formula,
    C3: = textjoin("*", 1, makearray(len(C2), len(C2), lambda(x, y, mid(C2, x, 1) & mid(C2, y, 1))))

    C10: = let(a, makearray(len(C2), len(C2), lambda(x, y, mid(C2, x, 1) & mid(C2, y, 1))); textjoin("*", 1, map(a, lambda(x, if(sum(map(arrayformula(mid(C9, sequence(len(C9), 1), 1)), lambda(y, --isnumber(find(y, x)))))>0, x, ""))))

    Thank you very much for your help, always success to @windknife @AliGW

  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
    81,091

    Re: Change the value to 2 digits

    I did it for you in your GoogleSheet - you diodn't have to do anything!!!

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) 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 each of those who offered help.

  24. #24
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,008

    Re: Change the value to 2 digits

    You are welcome.

+ 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. Can't Change Number of Digits After Decimal
    By jdrenken7 in forum Excel - New Users/Basics
    Replies: 12
    Last Post: 07-03-2017, 12:41 AM
  2. Change font colour of digits within numbers
    By NickyC in forum Excel General
    Replies: 7
    Last Post: 09-04-2011, 10:26 PM
  3. Replies: 4
    Last Post: 10-31-2010, 11:08 AM
  4. Need help with a macro that will change digits in a number.
    By drevil7171 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2006, 11:45 PM
  5. How to change digits in a string? Very large list
    By drevil7171 in forum Excel General
    Replies: 1
    Last Post: 12-14-2006, 11:42 PM
  6. last digits change to zero
    By djgosling in forum Excel General
    Replies: 2
    Last Post: 03-04-2006, 08:00 AM
  7. [SOLVED] change ten digits in a cell to include phone # formats
    By Judi Mason in forum Excel General
    Replies: 4
    Last Post: 10-24-2005, 09:05 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