Need Help: IF AND and Search text from multiple columns

punksterz626

New Member
Joined
Jun 30, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello Colleagues,

Hoping everyone is doing well. I'm having a hard time creating a formula that meets this scenario, hoping someone can help me.

I have multiple columns in the sheet, but to simplify I'll just list the columns that pertain to this scenario. I want to do a search criteria in the Description column, but only if Type column is "ShoeSales", if not just leave blank. Is this possible?



TypeDescriptionSearch CriteriaResult Wanted FOR ShoeSales
ShoeSalesSS project ABCDif column A =ShoeSales & Description has "ABCD"SS ABCD
PantSalesPS project ABCD
ShoeSalesSS project ABCDif column A =ShoeSales & Description has "ABCD"SS ABCD
ShoeSalesSS project M&Sif column A =ShoeSales & Description has "M&S"SS M&S
ShoeSalesSS project TTDif column A =ShoeSales & Description has "TTD"SS TTD
PantSalesPS project
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Welcome to the MrExcel forum!

How do you determine what codes (ABCD, M&S, TTD, etc.) that you want to look for? Do you have a table of them? What do you want if it says ShoeSales, but none of the codes you have listed is there? Or do you want anything after the word "project"? Or some other method?
 
Upvote 0
Welcome to the MrExcel forum!

How do you determine what codes (ABCD, M&S, TTD, etc.) that you want to look for? Do you have a table of them? What do you want if it says ShoeSales, but none of the codes you have listed is there? Or do you want anything after the word "project"? Or some other method?
The codes are part of the description and they're listed after the project name at the end of the description, if that helps. They are mostly unique but not always, hence the reason I want an if statement to the Type. That will for sure pull the correct data.

What do you want if it says ShoeSales, but none of the codes you have listed is there? It is unlikely this will happen, but if it does, leave blank.
 
Upvote 0
I'm still hazy on how to recognize the codes. So far the best idea I've got is to just use the last word from the description. Try:

Book3
ABC
1TypeDescriptionResult
2ShoeSalesSS project ABCDSS ABCD
3PantSalesPS project ABCD 
4ShoeSalesSS project ABCDSS ABCD
5ShoeSalesSS project M&SSS M&S
6ShoeSalesSS project TTDSS TTD
7PantSalesPS project 
Sheet29
Cell Formulas
RangeFormula
C2:C7C2=IF(A2="ShoeSales","SS "&TRIM(RIGHT(SUBSTITUTE(B2," ",REPT(" ",100)),100)),"")
 
Upvote 0
If you happen to have the TEXTAFTER function in your 365 version then you could try the C2 formula below.
If you do not have the TEXTAFTER function then you could try the modified version of Eric's formula in D2, which does not need to be copied down the column - it automatically 'spills' the other results down the column.

22 07 01.xlsm
ABCD
1TypeDescriptionResult 1Result 2
2ShoeSalesSS project ABCDSS ABCDSS ABCD
3PantSalesPS project ABCD
4ShoeSalesSS project ABCDSS ABCDSS ABCD
5ShoeSalesSS project M&SSS M&SSS M&S
6ShoeSalesSS project TTDSS TTDSS TTD
7PantSalesPS project
Search Text
Cell Formulas
RangeFormula
C2:C7C2=IF(A2:A7="ShoeSales","SS "&TEXTAFTER(B2:B7," ",-1),"")
D2:D7D2=IF(A2:A7="ShoeSales","SS "&TRIM(RIGHT(SUBSTITUTE(B2:B7," ",REPT(" ",100)),100)),"")
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,659
Members
449,178
Latest member
Emilou

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