简体   繁体   中英

Excel conditional format-Text into column based on another cell value

I am trying to find a specific conditional formatting formula. I want specific cells within a column to automatically fill with a specific text based on what cell value I type into an adjacent cell. What formula would be best to use?

The attached image should help to explain. I want the column (LITH) to populate with any of the text choices in the column (LITHTYPES), based on the criteria of typing in (CODE) numbers -1 to 5 in column (LITH_CODE)

文本到特定单元格值的条件格式

I agree with @cybernetic.nomad. I think you are looking for a vlookup or a combination index + match . Conditional formatting is used for changing colour of cell/text based on criterias. The formula you are looking for (enter it in Cell F2 and drag down) is (notice I use " ; " as delimiter instead of " , ":

=IF(E2="";"";INDEX($N$4:$N$10;MATCH(E2;$M$4:$M$10;0)))

The formula is explained by the following parts: IF(if a cell in column LITH_CODE is empty; if it's empty then show nothing; do lookup )

The do lookup part contains of: INDEX(return value from LITHTYPES ; MATCH(lookup value from LITH_CODE column ; look for the value from LITH_CODE in the column "M" CODES; give only exact match))

I think the picture below gives a good view:

在此处输入图片说明

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