简体   繁体   中英

match and replace cell values from 1 sheet to another

我有两个Excel工作表,即sheet1 sheet2,并且都具有超过10000行,sheet1 F具有数字值。如果这些值的最后三位与sheet2 A相匹配,请替换sheet2 D数据中该单元格的完整值。

To actually replace cell values would require a VBA macro. Alternatively, you could create a new column and use a lookup formula to compare the last three digits and populate with either the original value from column F or a replacement value from Sheet 2. This would then become your new column F. To get the last three digits you can use

=right($F1, 3)

which will give you the last three characters from F1. Use an IF statement to compare the two values

=IF(right($F1, 3)=Sheet2!$A1, Sheet2!$D1, $F1)

This compares the last three digits of F1 with Sheet2 A1 and returns Sheet2 D1 if they match or the original F1 if they don't.

I am assuming that you are matching row for row, as three digits would repeat over a 10000 row range.

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