Extract word within string in Excel row - excel

I am trying to pull some information from one string of text into it's own field and wonder if somebody can help. Sounds simple enough and I can get it working how I want, but when the position of the text moves around, it can't find it. I've tried using Mid, left, right, without much success.
It is a basic spreadsheet used as a job list, to monitor which country each item was sent to. Or, whether it wasn't dispatched using a courier, and nothing is required to be noted.
Hopefully my photo explains it, and the formula in this photo is:
=MID(LEFT(A1,FIND(")",A1)-1),FIND("(Shipped to ",A1)+12,LEN(A1))
I have rows of text showing something along the lines of:
Job title (Shipped to UK) (Postage Tracking No 123456890)
Job title (Shipped to Belgium) (Postage Tracking No 123456890)
Job title (Shipped to Austria) (Postage Tracking No 123456890)
and my code above will pull through the country, as I want.
.. but ever so often, each line will flip around, so show like:
Job title (Postage Tracking No 123456890) (Shipped to UK)
.. which upsets the formula due to the left/right/mid positioning.
This is an ongoing spreadsheet, so I'd like to be using a single formula if possible. I know I can workaround by running second formulas on erroneous entries but would rather not do that.
Lastly, when there was no shipping involved, it generates a value error (as it couldn't find the string whatsoever). Again, I could make this say "No shipping" by running a second formula, but not ideal.
Anyone got any better simpler ideas? Photo attached for reference!
I'm just looking to pull out the word after "(Shipped to " and before the following ")" regardless of it's relative position in the line of text.
Thanks a lot
Photo: https://i.stack.imgur.com/HU6lB.png

=MID(MID(A1,FIND("SHIPPED TO",UPPER(A1),1)+11,25),1,FIND(")",MID(A1,FIND("SHIPPED TO",UPPER(A1),1)+11,25),1)-1)
This takes a 25 character slice of the string and looks at it. If it's at the end of the string, it won't matter. From there, it will dissect it further by only using that slice to work from.

Related

Is there a way to get the the cell coordinates as an output

I am currently trying to build a sheet that allows the user to enter a list of stuff they need to do, and what day they need to do it by. Once they enter the day the need to do it by, which is not formatted as a date, but a simple number, it will then appear on the calendar. The issue I am running into is that it seems really hard to get the coordinates of a cell as an output. I am currently trying to use this line
'''=if(MATCH(J4,D5:D29),OFFSET(MATCH(J4,D5:D29),0,-2,1,1), "free")'''
but it keeps saying "the argument must be a range. Please tell me if I am missing something, or there is a way to do this better.
EDIT: The box that has the 2 and #N/A is where the data from the left side is supposed to be going. Since the date is 2, the word "heating" should be showing up in the cell.
Use simple XLOOKUP() function like-
=XLOOKUP(J$4,$D$5:$D$9,$B$5:$B$9)

Remove everything after hyphen in hyphenated names in Excel using Formula

I am in charge of adding new employees to our speech recognition and gamification systems.
When I get a batch of tickets, I compile a bunch of data into a spreadsheet that I then reference when adding those users to the systems (Which unfortunately do not have a JSON/CSV upload option or anything similar)
To save some time with compiling, I've started exporting a bunch of data from our database and our HR management system into that sheet, and then using the new employee's email to XLOOKUP all the other data fields.
For one of our systems, it has a strict character limit, and the format for the username is "cde\firstname.lastname". This is no problem to CONCATENATE normally, but it has a strict character limit, so if the user has a hyphenated last name, I will basically dump everything after the hyphen.
At first I tried a simple formula using a combination of LEFT and FIND -1 to find the hyphen, and then take everything to the left of it. This obviously doesn't end up working because I get a #VALUE! for anyone without a hyphen in their last name.
I tried using IFERROR to say "OK try to return the last name without a hyphen, otherwise just return the last name", but for some reason when I put the reference in the Return_If_Error portion, it doesn't recognize it as a reference.
So I am looking for a formula that will work with a LOOKUP'd value and only give me what's before a hyphen, but otherwise will still just give me the last name.
The baseline formula I have, that just looks up and concatenates the first and last into the "cde\firstname.lastname" is:
=CONCATENATE("cde\",LOWER(XLOOKUP(G578,Sheet4!M:M,Sheet4!B:B)),".",LOWER(XLOOKUP(G578,Sheet4!M:M,Sheet4!C:C)))
To expand on the comments, you've got the right idea, just use an IF statement for testing if the string contains "-", then use the normal string functions like FIND, LEFT, etc. to pick out the things you want.
For example:
="cde/"&
LEFT(H1,FIND(".",H1)-1)&
IF(ISNUMBER(FIND("-",H1)),MID(H1,FIND(".",H1),FIND("-",H1)-FIND(".",H1)),
MID(H1,FIND(".",H1),FIND("#",H1)-FIND(".",H1)))

Excel: Text mining using IF, ISNUMBER, SEARCH

I'm trying to clean up job title data using the formula below:
=IF(OR(ISNUMBER(SEARCH({"admin","reception","account","finance","HR","public","sales","customer","creative","IT","human"},A1))),"",A1)
It should work by eliminating job titles with any of the texts specified in the quotes above. However, I've encountered an issue where it doesn't. In a case where the job title is Quantity Surveyor, the title contains none of the specified texts but Excel seems to reflect it as such. What am I not doing right here?
Quantity Surveyor Example
To extract the information you are looking for, this is the formula you want to use:
=IFERROR(IF(OR(ISNUMBER(SEARCH({"admin","reception","account","finance","HR","public","sales","customer","creative","human"},A1)),NOT(SEARCH("Quantity",A1))),"",A1),"")
Using countif you don't need to check for errors if they occur:
=IF(OR(COUNTIF(A1,{"admin","reception","account","finance","HR","public","sales","customer","creative","human"}))+COUNTIF(A1,"<>Quantity"),"",A1)
Select the part of formula of search, and then press F9. You will find the match result of 6, where it has original value of 'IT', it means Quantity, has IT.
I really donot know why there is negative vote as not useful.
Here is the formula to solve your problem
=IFERROR(LOOKUP(1,0/FIND({"admin","reception","account","finance","HR","public","sales","customer","creative","IT","human"},A1)),A1)
Of course, it is better to define a range instead of hard code {}, like below
=IFERROR(LOOKUP(1,0/FIND($J$2:$J$7,A2),$K$2:$K$7),A2)

Select filtering and applying quantity amount to listed percentages

I tried to search but didn't find anything that was exact to what I was looking for. Let's say that I have the Investment$$ and I want to allocate that amount to only Items = to Toy Story and where Character begins with TS. The Investment $$ should only be applied to "Toy Story" and where character begins with "TS".
Apologies on not being able to embed the pictorial example to this message.
I need to write this in VBA. My questions is, is the best way to do this through a vlookup (programmed via VBA)? I want to avoid having the $1000 applied to the wrong movie title and even when it is applied to the right one (Toy Story) I want to make sure it's applied to the right ("TS") ones.
I'll also experiment on my end as well.
Pixar Movie Example
No need for VBA here. You can go with a plain vanilla Excel formula.
What you need in this situation is a key/ID item for your VLOOKUP - how you make that key is up to you, but with it you can easily utilize VLOOKUP. See my below example:

excel vba Delete entire row if cell contains the GREP search

I have a single column of text in Excel that is to be used for translating into foreign languages. The text is automatically generated from an InDesign File. I would like to clean it up for the translator by removing rows that simply contain a number ("20", 34.5" etc), or if they contain a measurement "5mm", "3.5 µm", etc. I've found many posts (see link below) on how to remove a row with specific string, but none that use search strings, such as those I typically use with GREP searches: "\d+" and "\d.\d µm"
How would I do this? I am on Mac iOS if that helps.
Note that I would need to delete the row if the cell only contains a number or a measurement, not if the number is contained within a phrase, sentence, or paragraph, etc.
https://stackoverflow.com/a/30569969
It may not be what you are looking for, but how about just sorting the column and remove the rows starting with numbers? It is a manual approach but from what I understand this translation process only happens from time to time. Am I right?
I see two possible issues in your question:
How to work with regular expressions in Excel?
How to delete rows in a loop?
Let me start with the second question: when you want to create a for-loop in order to remove items from a list, you MUST start at the end and go back to the beginning (it's a beginner's trick, but a lot of people trip over it.
About the first question: this is a very useful post about this subject, it's too large to even give a summary here.

Resources