Insert Data based on Partial contents of adjacent cell

hkydad

Board Regular
Joined
May 16, 2013
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hi,

I apologize if this question has been answered but I wasn't able to locate the thread.

What I am trying to do is insert a formula that looks at the adjacent cell to see if the text includes "-Ann" or "-SANN" and then enter ABCD or EFGH in the adjacent cell.

So if column B includes "-ANN" then "ABCD" should appear in column C. If column B includes "-SANN" then "EFGH should appear in column C.

Thank you.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
How about
Excel Formula:
=IF(ISNUMBER(SEARCH("-ann",B2)),"abcd",IF(ISNUMBER(SEARCH("-sann",B2)),"efgh",""))
 
Upvote 0
How about
Excel Formula:
=IF(ISNUMBER(SEARCH("-ann",B2)),"abcd",IF(ISNUMBER(SEARCH("-sann",B2)),"efgh",""))
Hi...I entered the formula '=IF(ISNUMBER(SEARCH("-ann",B2)),"abcd",IF(ISNUMBER(SEARCH("-sann",B2)),"efgh",""))' and the only value being returned is abcd. Column B will have items in it that end in either -ann or -sann.

Thanks,
 
Upvote 0
In that case can you post a sample of your data.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Here is my mini sheet

Excel Formula.xlsx
AB
1
2Doc CodeCompany Name
3Column B should be A-BCD if column A includes "-ANN" Column B should be E-FGH if column A includes "-SANN"
4
5
6ABC-SANN
7TDP-ANN
8DIS-SANN
9ESP-ANN
10CAR-ANN
11ACAN-ANN
12ADIS-SANN
13AESP-SANN
14ATDP-SANN
Sheet1
 
Upvote 0
Thanks for that. The formula I suggested works on that data
+Fluff 1.xlsm
AB
1Doc CodeCompany Name
2 
3 
4 
5ABC-SANNefgh
6TDP-ANNabcd
7DIS-SANNefgh
8ESP-ANNabcd
9CAR-ANNabcd
10ACAN-ANNabcd
11ADIS-SANNefgh
12AESP-SANNefgh
13ATDP-SANNefgh
14
Data
Cell Formulas
RangeFormula
B2:B13B2=IF(ISNUMBER(SEARCH("-ann",A2)),"abcd",IF(ISNUMBER(SEARCH("-sann",A2)),"efgh",""))
 
Upvote 0
Solution
Thank you for checking the formula. For whatever reason it wasn't working when I first tried it but now it is working. Thank you so much.
 
Upvote 0
Glad it's sorted & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top