简体   繁体   中英

How to enter information in one cell based on text in another cell

I would like to enter information in a cell based on the text contained in a different cell. Specifically, if a cell in column A contains text that includes "insurance," "retirement," or "401K," then I want to place an "x" in its respective cell in Column B. If not, then cell B1 should be empty. The text needs to be contained within the cell, but does not need to be the exact text. Eg, an "x" would still be placed in the column next to "life insurance" or "insurance," "whole life insurance," etc.

Eg,

Column A        Column B
Life Insurance  x
Securities
Retirement      x

I tried to use the following formula, but am getting an error message when I do so:

IF(OR(ISNUMBER(SEARCH("insurance",A1,"retirement",A1, "401K",A1)),"x", "")

Any thoughts?

This formula should help:

=IF(OR(ISNUMBER(FIND("Insurance",A1)),ISNUMBER(FIND("Retirement",A1)),ISNUMBER(FIND("401K",A1))),"x","")

EDIT:

I came up with an array formula that I like a little better. Hope this helps:

=IF(COUNT(MATCH({"*Insurance*","*Retirement*","*401K*"},A1,0))>0,"x","")

This will require pressing CTRL + SHIFT + ENTER instead of just ENTER after putting it in the cell because it's an array formula.

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