简体   繁体   中英

How to replace the value of one cell with another based on whether a word exists in a specific cell

I have a basic question. I have a one column which represents a quantity. The cell to the right is a new column that will contain a word. I want to search cells in one column for the word and if it appears replace the word, let's say "foil" with the value of the cell to the left. A2 represents the cell A2, and I am checking B2. This formula is not working. I want the value of cell A2, not literally "A2"

=IFERROR(IF(SEARCH("*foil*",B2,1),"A2"),"0")

Thank you so much for your help. I really appreciate any and all help with this.

While you are using SEARCH() function you do not need to use wild card . Remove double quote from "A2" so that formula can show data of A2 cell instead of text A2 . See below...

=IFERROR(IF(SEARCH("Foil",B2,1),A2),0)

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM