简体   繁体   中英

How to change values in a column based on cell values in another column in excel?

I read about if condition but apparently it only applies to single cell of two columns . I was wondering if there is way to modify the entire column based on cell values from another column. For example

=================            ================
       A                           B
=================            ================
     France                     Hong Kong
     USA                        New York
     China                      Hong Kong
     China                      New York

I want cell values in col A to change based on col B , so France becomes China in row 1 and China becomes USA in row 4 and so on. Is there any way to accomplish this?

You need to have table or array ie 2 columns. Then use this table/array in vlookup Refer link .

Have a table in Sheet2 as follows.

=================  ================
       A                   B
=================  ================
      Delhi              India
      New York           USA
      Hong Kong          China

Then in first sheet use the following formula.

=INDIRECT( "Sheet2!B" & MATCH(A1, Sheet2!A:A, 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