SOLVED

Alphabet Wrap

Copper Contributor

Input is any letter in the alphabet.

Advance that letter x amount.

If input is 'B', then output is B + x

If output exceeds Z, I'd like it to wrap back around to the beginning of the alphabet instead of something like BC or AD

So input is Y and x = 4 then output should be C

 

Thanks

 

5 Replies

@MajorHavoc Perhaps like this (with input in B1 and x in B2)?

=CHAR(IF((CODE(B1)+B2)>90,CODE(B1)+B2-26,CODE(B1)+B2))

This assumes that you only enter capitals, by the way.

 Screenshot 2021-02-26 at 07.38.02.png

Try this, where A1=Y and B1=4

=CHAR(MOD(CODE(UPPER(A1))+B1-64,26)+64)

@JMB17 

 

Yes that works well with upper case but if lower case is entered it advances 10 places and outputs " j " .

Very confusing.

 

This only works for upper case.

But it's a start.

best response confirmed by MajorHavoc (Copper Contributor)
Solution

@MajorHavoc 

 

Okay, give this a try:

=IF(EXACT(A1,UPPER(A1)),CHAR(MOD(CODE(A1)+B1-65,26)+65),CHAR(MOD(CODE(A1)+B1-97,26)+97))

1 best response

Accepted Solutions
best response confirmed by MajorHavoc (Copper Contributor)
Solution

@MajorHavoc 

 

Okay, give this a try:

=IF(EXACT(A1,UPPER(A1)),CHAR(MOD(CODE(A1)+B1-65,26)+65),CHAR(MOD(CODE(A1)+B1-97,26)+97))

View solution in original post