Find/Repalce

  • Thread starter Thread starter lightbulb
  • Start date Start date
L

lightbulb

I have a file in which cells have text followed by numbers...the ending
numbers are always 4 digits....anytime the number is greater than 2550, I
want to replace it with 2550, is there a way to generate a formula or a macro
that can do that but not mess with the text before it in the cell?

Thanks!
 
The number will always have a "Z-" before it, so that may be able to be an
indicator...however if it is "X-" OR "Y-" I do not want the number changed.
 
With your data in cell A1; try the below formula

=IF(ISERROR(SEARCH("Z-",A1)),A1,LEFT(A1,SEARCH("Z-",A1)+1) &
MIN(2550,MID(A1,SEARCH("Z-",A1)+2,5)))
(all in one line)

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top