Link to home
Start Free TrialLog in
Avatar of cpatte7372
cpatte7372Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Excel Replace Items

Hi Experts,

Can someone please tell me if it possible to replace more than one item in excel?

For example, if I wanted to replace the numbers 5,4,3,2,1 with 1,2,3,4,5 can I do that in one shot?

At the moment, I would have to replace 5, with 1, then go back in and replace 4 with 2 etc...


Cheers

Carlton
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

No you can't. And doing it one at a time will be tricky since you'll end up replacing items multiple times - e.g. you convert 5 to 1, then later you convert all 1s to 5s!
Your problem will come when you get past 3.....

Replace all 5 with 1
Replace all 4 with 2
3 = 3 anyway
Replace all 2 with 4 !!

Hold on!! All the ones that were 4 became 2! Now you dont know what 2 is a 2 and what used to be 4!

Needs a bit more thinking behind this one.
>>>>Can someone please tell me if it possible to replace more than one item in excel?

Yes it is possible via VBA Code. Let me create a sample for you.

Sid
Avatar of nettek0300
nettek0300

If the numbers are in a single cell, they you can do a find and replace.  Type 5,4,3,2,1 in the find and 1,2,3,4,5 in the replace field.  You can do each one individually by clicking replace, or all at one time with replace all.
ASKER CERTIFIED SOLUTION
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cpatte7372

ASKER

Sid,

That is exactly what I wanted.

You've come through again.

Cheers man.
Glad to be of help :)

Sid