IF Statement HELP!?

chadshowalter

New Member
Joined
May 23, 2012
Messages
2
I hope that one of your Excel Geniuses can help me out with this.

I have a master product file spreadsheet. When I exported from my Content Management System into a CSV file it created one column to designate the categories each product has assigned to it. For example, "Product A" falls into categories 817, 456, 234, 081, and 450.

THE PROBLEM

I need to identify one category within this string, say Category 456.

Excel understands this column to be one number, "817,456,234,081,450"

How can I write a IF formula that would seek out ",456," and populate a new cell with a new value?

I have tried changing the format of the column to text, however, then I lose all the comas, which creates a huge mess for me, because I can't tell the categories apart from each other (some categories have 3 numbers, some have 4, etc.)

I have tried a traditional IF statement, but it will find any occurrence of 456, as in " 134,560"

Any ideas would be greatly appreciated. I'm a newbie, so please be easy on me! :)

Chad
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
There's probably a more sophisticated way of doing it, but this would be a quick way.
Assuming the data you want separated is in Column A
1) In another column enter this formula: =text(A1,"#,###) & copy this
formula down to all the rows you wish to convert
2) Select the entire range of cells that now have the above formula and copy/Paste Special/Values
3) Select the same range then Alt+D+E to get to the "Convert Text to Columns Wizard"
Original Data Type choose "Delimited" > Next
Delimiters check ONLY "Comma" (In Data Preview you'll see it "split" data) >Next
Destination (browse to where you want the individual segments to go) >Finish
 
Upvote 0
Unsure about the search element you are using within the if statement but the below should work for you, just copy it down to end of your recordset. This is the quick way there are number of other ways if it's long term solution you need then you should think about VBA function instead

=if(iserror(search(",456,",A1)),"","found Product A")
 
Upvote 0
Building on Rallcorn's suggestion, with your data in column A, put this in A2 =MID($A1,COLUMN()*3-5,3)

Then drag down and across as needed, then copy and paste values.
 
Upvote 0
Unsure about the search element you are using within the if statement but the below should work for you, just copy it down to end of your recordset. This is the quick way there are number of other ways if it's long term solution you need then you should think about VBA function instead

I don't think the commas are part of the value - if Excel understands it to be a number, it is only displayed with commas.

Also, what if the three digits were at the beginning or end of the string?
 
Upvote 0
Why not do a Text to Columns with commas as the delimiter to separate the values?
 
Upvote 0
Why not do a Text to Columns with commas as the delimiter to separate the values?

He says when he changes the values to text he loses the commas - meaning they're only being displayed as part of the number. I believe you can't TTC based on that, though I may be mistaken.
 
Upvote 0
He says when he changes the values to text he loses the commas - meaning they're only being displayed as part of the number. I believe you can't TTC based on that, though I may be mistaken.

You cannot TTC if the commas are only displayed as a number separator . . . which is why I went through the exercise in steps 1 & 2 of post #2 to turn it into text and then do TTC. Round about way to get where he needs to be, but it works & is fairly quick.
 
Upvote 0
You cannot TTC if the commas are only displayed as a number separator . . . which is why I went through the exercise in steps 1 & 2 of post #2 to turn it into text and then do TTC. Round about way to get where he needs to be, but it works & is fairly quick.

You're preaching to the choir .. follow the thread ;)
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

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