I was hoping to be able to use ELSEIF statements in an excel function, but I guess you can't?
But basicallly, I have a bill of materials with a description column. I want to search that column for various words (ie. wheel, screw, spacer, shelf, etc) and return a value into another new column depending on that value (wheel inputs wheel, screw inputs hardware, spacer inputs hardware, shelf inputs shelf).
How Excel shows you how to search will only return one value because I can't use an else statement:
Here's probably a harder issue - there needs to be a hierarchy to the code so that "shelf screw" would return screw.=IF(ISNUMBER(SEARCH("SCREW",C14)),"Hardware", "")
There's about 30 different categories (return values) and about 3-4 words (per category) that could be located in the description that should return that value.
ie. SPACER, SCREW, NUT, BOLT will all return Hardware
I have a feeling I might be in the wrong forum. http://i28.tinypic.com/2dlr975.gif (apparently image tags are disabled...lol)
Thanks for any help!![]()
BTW, I searched for a similar situation in this forum for about 30-45min before posting what I figured might be a constantly asked question. And I found this website using google to look for tutorials and help. So I did some digging around other sites before just bugging you guys for some suggestions. Sorry for being another random new guy looking for help![]()
![]()
You're image link doesn't work for me....
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
Really? Maybe tinyurl gets work filtered some places. It's just a disturbed smile from another msg board I use. heh.Originally Posted by NBVC
BTW, I was born in Burlington, eh![]()
You could probably use a vlookup.
In one sheet you would have the list of words and categories associated with them and the use a vlookup formula like this:
=vlookup("*"&A1&"*",List!$A$1:$B$1000,2,0) dragged down.
- Portuga
There is no such thing as a problem, only a temporary lack of a solution![]()
In formulas,you might need to replace ; with , depending on your XL version
Oh... I see that smile... but I thought you had attached a sample file image.....Originally Posted by blacksheep
![]()
... well Portuga's got some suggestions for you to try....
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
I can't get that to do anything but find the first category written down and then N/A the rest of them. Maybe I just need to understand what lookup_value you're using means?Originally Posted by Portuga
BTW, in Sheet 2, I'm organizing them like:
COL1 COL2
SCREW Hardware
SPACER Hardware
NUT Hardware
SHELF Shelf
In Sheet1 it'll only look like
PART1 Hardware
PART2 #N/A
PART3 #N/A
...I'd take screenshots but I can't put the BOMs online. :\
You coud post the sheet (zipped preferably).
Or just post the sheet (unziped)
(less than 100K either way)
- Portuga
There is no such thing as a problem, only a temporary lack of a solution![]()
In formulas,you might need to replace ; with , depending on your XL version
Hi blacksheep, but I just realized that the Vlookup solution I gave you is a bunch of C**p!
Apologies. I think the solution would probably involve a match/index combination, with a named range... (maybe)
- Portuga
There is no such thing as a problem, only a temporary lack of a solution![]()
In formulas,you might need to replace ; with , depending on your XL version
It's not doing the N/A anymore, I guess I was messing with it...
It's still doing something funky though.
Thanks for the help btw..
Last edited by blacksheep; 04-18-2008 at 03:45 PM.
I got it to do what I want with some very simple function use and ridiculous effort - it's also not perfect at doing what I need it to and is annoying to update. Hopefully you can better see my intent now.
Thanks again!![]()
Last edited by blacksheep; 04-21-2008 at 04:27 PM.
Also, I have an easier question...
The if statement that looks for ASH within the description is returning WASHER too. How do I tell it to look for ASH without any letters on either side?
Thanks![]()
Hey,
Just noticed something in your sheet...
You have a unique part number.
Why dont you have the list of all part numbers and then have a corresponding column for the "Type".
Once you would have that list complete you just need a Vlookup formula.
_____________________________________
I had a very unelegant solution. Basically a concatenation of your original formula that might work.
=IF(ISNUMBER(SEARCH("SCREW",C14)),"Hardware", "")&IF(ISNUMBER(SEARCH("BEZEL",C14)),"BEZEL", "")
- Portuga
There is no such thing as a problem, only a temporary lack of a solution![]()
In formulas,you might need to replace ; with , depending on your XL version
Aha! That's how I combine the if statements! :D After doing some of them like that I'm not sure I like it that way though because of some of the issues with double categorizing. Maybe I can make the rules more specific and use it.Thanks for this!
And unfortunately the part numbers, although unique, are not smart. So trying to use them to develop a category structure won't work. :\ The second that you think you see a pattern I could find you another list of them where someone screwed it up and used the wrong first digit. lol.
The solution I gave you only concatenates different, one statement formulas.
If you want to combine different conditions you can use the "or" or "and" in one if statement:
Ex:
The formula above will return "hardware" if in C14 are words "screw"or "spacer" or Shelf"IF(OR(ISNUMBER(SEARCH("SCREW",C14)),ISNUMBER(SEARCH("SPACER",C14)),ISNUMBER(SEARCH("SHELF",C14))),"HARDWARE", "")
The formula above will return "hardware" if in C14 are words "screw" and "spacer" and Shelf"IF(AND(ISNUMBER(SEARCH("SCREW",C14)),ISNUMBER(SEARCH("SPACER",C14)),ISNUMBER(SEARCH("SHELF",C14))),"HARDWARE", "")
- Portuga
There is no such thing as a problem, only a temporary lack of a solution![]()
In formulas,you might need to replace ; with , depending on your XL version
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks