Code

alliswell

Board Regular
Joined
Mar 16, 2020
Messages
190
Office Version
  1. 2007
Platform
  1. Windows
  2. Mobile
ROYALKINGS where
R=1,O=2,Y=3,A=4,L=5,K=6,I=7,N=8,G=9,S=0
Now whenever i type any code for example when i put YLS in a1 i should get 350 in b1 coz y=3, L=5, s=0
I dont want macro. Some formula function or trick.

Thanks n regards
Love u all
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
You could use something like
Excel Formula:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"R",3),"O",2),"Y",3),"A",4)
Just add the rest of the substitutes.

Are you still using xl 2007? There are "simpler" ways if you have 365 or 2021
 
Upvote 0
You could use something like
Excel Formula:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"R",3),"O",2),"Y",3),"A",4)
Just add the rest of the substitutes.

Are you still using xl 2007? There are "simpler" ways if you have 365 or 2021
Fluff,
I was thinking the same thing, though hoping their might be an easier way than nesting 10 SUBSTITUTE functions!
On top of that, the SUBSTITUTE function is case-sensitive. They mentioned "yls".
If they want it to be case agnostic, they will need to add the UPPER function to each of those nested SUBSTITUTE functions too!
Not difficult, but that is going to be one LONG formula!
 
Upvote 0
try this:
Excel Formula:
=MOD(FIND(LEFT(A1,1),"ROYALKINGS"),10)&MOD(FIND(MID(A1,2,1),"ROYALKINGS"),10)&MOD(FIND(MID(A1,3,1),"ROYALKINGS"),10)
 
Upvote 0
try this:
Excel Formula:
=MOD(FIND(LEFT(A1,1),"ROYALKINGS"),10)&MOD(FIND(MID(A1,2,1),"ROYALKINGS"),10)&MOD(FIND(MID(A1,3,1),"ROYALKINGS"),10)
And to make that case agnostic, just convert all instances of "A1" with "UPPER(A1)", i.e.
Excel Formula:
=MOD(FIND(LEFT(UPPER(A1),1),"ROYALKINGS"),10)&MOD(FIND(MID(UPPER(A1),2,1),"ROYALKINGS"),10)&MOD(FIND(MID(UPPER(A1),3,1),"ROYALKINGS"),10)

EDIT: I didn't analyze this closely and realize that this works for only exactly 3 characters!
 
Upvote 0
@offthelip what if the OP wants to enter 7 characters, or any other number?
 
Upvote 0
Thanks everybody. Thanks a lot everybody.
Dear fluff how to in 375 snd 2021 as u said its easier.
 
Upvote 0
You could use
Excel Formula:
=CONCAT(RIGHT(SEARCH(MID(A1,SEQUENCE(LEN(A1)),1),"royalkings")))
 
Last edited:
Upvote 0
Solution
Joe n fluff gr8. Thanks. Offthelip thanks to you too but it works for 3 digits only what if i need 10 digits code. And thanks to rest of all buddies whom i missed to thank. You all did gr8 job. Mrexcel peoples are GENIUS
 
Upvote 0

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top