SOLVED

Alphabet Wrap

%3CLINGO-SUB%20id%3D%22lingo-sub-2167710%22%20slang%3D%22en-US%22%3EAlphabet%20Wrap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2167710%22%20slang%3D%22en-US%22%3E%3CP%3EInput%20is%20any%20letter%20in%20the%20alphabet.%3C%2FP%3E%3CP%3EAdvance%20that%20letter%20x%20amount.%3C%2FP%3E%3CP%3EIf%20input%20is%20'B'%2C%20then%20output%20is%20B%20%2B%20x%3C%2FP%3E%3CP%3EIf%20output%20exceeds%20Z%2C%20I'd%20like%20it%20to%20wrap%20back%20around%20to%20the%20beginning%20of%20the%20alphabet%20instead%20of%20something%20like%20BC%20or%20AD%3C%2FP%3E%3CP%3ESo%20input%20is%20Y%20and%20x%20%3D%204%20then%20output%20should%20be%20C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2167710%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2167918%22%20slang%3D%22en-US%22%3ERe%3A%20Alphabet%20Wrap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2167918%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F561330%22%20target%3D%22_blank%22%3E%40MajorHavoc%3C%2FA%3E%26nbsp%3BPerhaps%20like%20this%20(with%20input%20in%20B1%20and%20x%20in%20B2)%3F%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DCHAR(IF((CODE(B1)%2BB2)%26gt%3B90%2CCODE(B1)%2BB2-26%2CCODE(B1)%2BB2))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThis%20assumes%20that%20you%20only%20enter%20capitals%2C%20by%20the%20way.%3C%2FP%3E%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-02-26%20at%2007.38.02.png%22%20style%3D%22width%3A%20550px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F258266iB9A7ECE26705D2C7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-02-26%20at%2007.38.02.png%22%20alt%3D%22Screenshot%202021-02-26%20at%2007.38.02.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2167927%22%20slang%3D%22en-US%22%3ERe%3A%20Alphabet%20Wrap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2167927%22%20slang%3D%22en-US%22%3ETry%20this%2C%20where%20A1%3DY%20and%20B1%3D4%3CBR%20%2F%3E%3CBR%20%2F%3E%3DCHAR(MOD(CODE(UPPER(A1))%2BB1-64%2C26)%2B64)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2169944%22%20slang%3D%22en-US%22%3ERe%3A%20Alphabet%20Wrap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2169944%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%20that%20works%20well%20with%20upper%20case%20but%20if%20lower%20case%20is%20entered%20it%20advances%2010%20places%20and%20outputs%20%22%20j%20%22%20.%3C%2FP%3E%3CP%3EVery%20confusing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2169962%22%20slang%3D%22en-US%22%3ERe%3A%20Alphabet%20Wrap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2169962%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20only%20works%20for%20upper%20case.%3C%2FP%3E%3CP%3EBut%20it's%20a%20start.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2170136%22%20slang%3D%22en-US%22%3ERe%3A%20Alphabet%20Wrap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2170136%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F561330%22%20target%3D%22_blank%22%3E%40MajorHavoc%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOkay%2C%20give%20this%20a%20try%3A%3C%2FP%3E%3CP%3E%3DIF(EXACT(A1%2CUPPER(A1))%2CCHAR(MOD(CODE(A1)%2BB1-65%2C26)%2B65)%2CCHAR(MOD(CODE(A1)%2BB1-97%2C26)%2B97))%3C%2FP%3E%3C%2FLINGO-BODY%3E
New 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 (New 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))