If a cell contains specific text then return a certain value

jjkh58

New Member
Joined
Apr 21, 2021
Messages
8
Office Version
  1. 365
  2. 2013
  3. 2011
  4. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Hi guys,

Column C
C1: AS2_Receiver_AdvancedShipmentNotification
C2: AS2_Sender_AdvancedShipmentNotification

I have something like the above in my spreadsheet. I need to use the formula to tell me whether it's Receiver or Sender, so I used =IF(C1="Receiver","Receiver","Sender") formula to return receiver if the cell contains a word receiver otherwise sender. However, my formula does not work.

Please help me out.

Thanks,
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi jjkh58,

The following will return what's in-between the first and second underscore or nothing if it errors out:

=IFERROR(MID(A1,FIND("^^",SUBSTITUTE(A1,"_","^^",1))+1,(FIND("^^",SUBSTITUTE(A1,"_","^^",2))-FIND("^^",SUBSTITUTE(A1,"_","^^",1)))-1),"")

Regards,

Robert
 
Upvote 0
formula to return receiver if the cell contains a word receiver otherwise sender.
Based on that, & assuming underscore before/after like your samples, try
Excel Formula:
=IF(ISNUMBER(SEARCH("_Receiver_",C1)),"Receiver","Sender")

If the word always comes after 4 characters like your samples then possibly just this.
Excel Formula:
=IF(MID(C1,5,8)="Receiver","Receiver","Sender")
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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