Link to home
Start Free TrialLog in
Avatar of Michael Sterling
Michael SterlingFlag for United States of America

asked on

How do you replace data in selected cells in excel?

How do you replace data in selected cells in excel? What's the correct formula in excel (2007)?
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Have you checked the Replace() in Excel

From the Excel help file

REPLACE(old_text,start_num,num_chars,new_text)

Sid
Avatar of GrahamSkan
This should do it:

    Selection.Replace What:="abc", Replacement:="def"
Note that the above is VBA macro language, not an Excel formula.
Avatar of Michael Sterling

ASKER

@Graham: yeh,... i need an actual excel formula

@Sidd: I've tried that, it only works for the first cell that I have highlighted. it doesn't seem to work for multiple selected cells. Any idea why? or how to make it work for when more than one cell is selected?
For that you will have to use VBA .Find()

Here is a small tutorial I wrote on .Find()

http://www.vbforums.com/showthread.php?p=3922547

Sid
@Sid: I appreciate the link, i really was looking to get this done in excel, using what's available to me in excel. is this possible?
Hmm, With one formula replacing multiple cell is not possible. At least I am not aware of.

Sid
@Sidd: ok, thanks it was just for a one time problem that i didn't want to have to touch each column for but looks like i'm gonna have to. No biggie, I may use your code, in the future, (written in C#: [shhh, i don't know VB very well...;-)] to build a utility for future instances and in case a bigger use for this comes up. Thanks again.
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
It is not possible is also a Valid Answer ;)
SOLUTION
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
always overlook the obvious...thanks dlmille. i was making it too complicated...i saw the cells and immediately starting thinking formula...
Mike. How does that answer to your original question?

Sid
I'm not really into Excel formulae, but, as I understand the situation, it doesn't sound like the sort of thing that a formula can do
You wanted an Excel Formula right?

>>>What's the correct formula in excel (2007)?

Sid
Oops. I see that is your conclusion as well.
Mike - I believe sid offered ctrl-F for manual replace as well ( I was sending at same time ) = recommend a points split at least!

Dave
Thanks Dave. not required. :)

Sid
@Sidd: My mistake, don't want to cheat or discount your efforts. I've sent a question to the moderator on how i can go about splitting the points.
Thanks Ok Mike :)

Sid
Yes, it would be helpful, if you accept a solution other than the ones that you specifically asked for, to indicate why you are assigning credit to any particular solutions offered.
@Graham & @Sidd: is it solved now?! never been through this process before...
You just carry on from here as if you were closing the question (by accepting one or more answers) for the first time.
sorry about the confusion, graham, if you feel that you are owed points too, let me know, it's no problem to re-do this...now that i know how