• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to add +1 to the last two digits of a number? [SOLVED]

shijilt

New Member
I want a way to do the following


Data I want result as

507-413-0109 507-413-0110

507-430-5409 507-430-5410

507-450-6649 507-450-6650

507-450-8640 507-450-8651

507-451-1563 507-451-1574


if the original number is 2133-2322 , I want it as 2133-2333 .

The last two digits should increase by value 1.

But , if there is a 9,

9+1 = 0

and

0+1 = 1


how to do it in Excel ?
 
Hi, shijilt!


First of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.


As a starting point I'd recommend you to read the green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).


Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.


Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.


And about questions in general...


If you haven't performed yet the search herein, try going to the topmost right zone of this page (Custom Search), type the keywords used in Tags field when creating the topic or other proper words and press Search button. You'd retrieve many links from this website, like the following one(s) -if any posted below-, maybe you find useful information and even the solution. If not please advise so as people who read it could get back to you as soon as possible.


And about this question in particular...


An alternative for strings of any length maybe this:

=IZQUIERDA(A1;LARGO(A1)-2)&TEXTO(RESIDUO(DERECHA(A1;2)+1;100);"00") -----> in english: =LEFT(A1,LEN(A1)-2)&TEXT(MOD(RIGHT(A1,2)+1,100),"00")


Regards!
 
SirJB7,


Please test your formula for entry number 4 and 5. It doesn't work there as it should add 11 in those cases ;)


It is because each operation doesn't affect the other. But the following would work.

=LEFT(A4,10)&MOD(MID(A4,11,1)+1,10)&MOD(RIGHT(A4)+1,10)
 
@shrivallabha

Hi!

You're right, I misread "The last two digits should increase by value 1" as adding 1 and modding to 100, thanks for the catch. My version of the formula should then be:

=IZQUIERDA(A1;LARGO(A1)-2)&RESIDUO(EXTRAE(A1;LARGO(A1)-1;1)+1;10)&RESIDUO(DERECHA(A1;1)+1;10) -----> in english: =LEFT(A1,LEN(A1)-2)&MOD(MID(A1,LEN(A1)-1,1)+1,10)&MOD(RIGHT(A1,1)+1,10)

Regards!
 
Back
Top