I have an excel sheet with 2 columns: absolute path and relative path.
Now say the data is in below format:
absolute path relative path
------------- -------------
/a/b/c/d/abc.dat
/x/y/z/def.dat
/p/q/r/s/t/test.dat
/a/b/c/d/abc.dat
/x/y/z/def.dat
The output should be
absolute path relative path
------------- -------------
/a/b/c/d/abc.dat ABCD_PATH
/x/y/z/def.dat XYZ_PATH
/p/q/r/s/t/test.dat PQRST_PATH
/a/b/c/d/abc.dat ABCD_PATH
/x/y/z/def.dat XYZ_PATH
-
If the 1st column contains
/a/b/c/d, then in the 2nd column it should place some unique string which I give here asABCD_PATH. -
If the 1st column contains
/x/y/z/, then in the 2nd column it should place some unique string which I give here asXYZ_PATH. -
If the 1st column contains
/p/q/r/s/t/, then in the 2nd column it should place some unique string which I give here asPQRST_PATH.
Create a mapping table in a sheet in your excel file (sheet2 for example):
Back to sheet1:
Put in
relative pathB2cell this formula:Hit Ctrl+Shift+Enter : it’s an array formula, also known as a CSE formula.
Copy
B2cell (not the formula) and paste it in the remaining cells in columnB.