I'm making a little program so I can get a better view of donations for a game.
What I want the program to do is split the text from textbox1.text into multiple textboxes.
Example: I want to split this text "20:12 01-04-2014 Ramon Geen $4.500.000.000".
So I want the name "Ramon" in a textbox called Name1 and I want the money in a textbox called Donation.
I already know how to remove the date from the text but I don't know how to remove the comment which can be different than Geen and I also don't know how to split the name and donation into separate textboxes. Can anyone tell me how to go about doing this?
Thanks in advance!
If the string is going to be completely variable then you may have some issues.
However, you know the following.
The right most text is always the money, so you can split the string on space and then put it into an array. Then the last element in the array will be the money. Also, the first portion will be the date. The second item in the array will be the name and everything else will be the comment.
I'm not going to code it all out for you, but if you have any questions just post the code and ill take a look.
Related
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.
I'm trying to bring back one of two possible words (Local or National) from a text string, and if neither of these words are in the text string, then bring back the string in the whole cell
The issue I have is that I can bring back either word when they appear, but I get an error when they do not
I'm currently using
=IFERROR(IF(SEARCH("*local*",B2,1),"Local"),IF(SEARCH("*national*",B2,1),"National"))
However this obviously this doesn't bring back if the words not exist
I'm sure it's easy and I'm missing something, but I just cannot figure it out. any help would be great
Cheers all
You can use:
Formula in B1:
=IF(ISNUMBER(SEARCH("*local*",A1)),"Local",IF(ISNUMBER(SEARCH("*national*",A1)),"national",A1))
Drag down
Note:
Notice that your wildcards make it that even a string with 'international' in it will return 'national'. If this is not what you want, you should remove the wildcards.
You can also use INDEX/AGGREGATE:
=IFERROR(INDEX({"local","national"},AGGREGATE(15,7,ROW($1:$2)/(ISNUMBER(SEARCH({"local";"national"},A1))),1)),A1)
This will allow one to replace the both hard coded arrays with a range of cells that contain the outputs. If Local and National were in D1:D2 then you can use:
=IFERROR(INDEX($D:$D,AGGREGATE(15,7,ROW($D$1:$D$2)/(ISNUMBER(SEARCH($D$1:$D$2,A1))),1)),A1)
That way if the list gets bigger the formula does not.
I'd suggest regular expressions.
=IF(REGEXMATCH(A2,"(Local|National)"),REGEXEXTRACT(A2,"(Local|National)"),A2)
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:
I have a function that uses an api to pull information based on the text given in the request.
The problem is that the text has to match the item exactly. Such as the item is named "Peach and Apple" and if you type "peach and apple" it will not return. You have to type "Peach and Apple" in order to properly request the item.
Is there a way I can send every variation of "Peach and Apple" (just incase is was something weird like "Peach and Le'Apple") with every variation of an uppercase letter?
I could make it uppercase every letter at the start of the string which is easy and would work with a lot of requests. Then I could uppercase every letter after a space which with the previous change would handle ALMOST every search.
The problem is I cannot make it uppercase every letter after a ' for this example(reason):
"Peach and Le'Apple" would work but "Peach and Apple's Leaf" would not work since the s is not uppercase. Thus is there a way to properly search for this?
Thanks for your time!!!
So I figured a way around it. The problem was that the items I was searching for had to be in the exact form. I was the one that saved those items from the api. So when I save them now I have 2 separate columns. One that saves the name with uppercase that will be what is shown on screen and another that saves the same name only purely converted to lowercase with toLowerCase(). This lets me search for the items and still keep the nice uppercase name without having to do some nasty logic I dont want to do.
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.