I have an excel spreadsheet that was exported from some software... it uses code that it understands, which makes sense, but the problem is that the output isn't always best for us humans for a quick visual. Especially when a person isn't accustomed to actually reading it.
Proof in point:
This is in cell column H:
2020-04-01T11:28:18+00:00
Now, I could create an excel formula that replaces every instance manually, but what I want to do is make is to that the T and everything right of is goes the way of the dodo.
I know that there is a substitute command in Excel, but it only would do the first, I forget if there is a way to actually make it so that it will ignore the text to the right, and just take it from the T to 14 steps right and delete it so that all that is left is the Year, day and month. I will use Excel VBA if need be, but I'd rather it be a formula if possible that I can use for a copy and paste in another sheet for readable output.
Thanks in advance.
With data in H1, in I1 enter:
=Left(H1,10)
You don't need to locate the T because its position is fixed.
Related
I am a programmer, so please bear with me. I understand that Excel isn't necessarily what I am used to in other domains, but I'm cracking my head open on how to accomplish something that seems somewhat simple.
I have a column of numbers that are themselves the basis of a formula. I want to filter those cells based on some criteria and pass them to another function to perform a calculation.
I understand that this can be done with "filters" in the excel sense. This would mean I would have to click multiple times for each calculation, filter the results, copy the value and paste it where I need it to be. If the data ever changes, I will have to do it all again.
What I am looking for is the equivalent of filtering in a programming language, here's an example:
let range = [1,2,3,4,0,-1,-2,-3,-4];
let subrange = range.filter(function (cell) { return cell > 0; });
subtotal(1,subrange);
So what my excel is like.
I have a column G, that has 12,000+ results in it, each one of these columns is like this:
=(En-Bn)/Bn
These are copied down, n means the row number from 5-12,000+
Now I would like to create a cell, M2 such that it contains:
=SUBTOTAL(1,[ Gn in G5:G12000 where Gn > 0 ])
The goal is that I do not want to have to point and click, because actually, there are many more cells I need to create (about 20) with similar kinds of "filter" predicates.
It would be nice, as much as possible, if I also don't have to specify the n...n-1 range of the column, as ideally that can change. Could be 10, could be 20,000, shouldn't matter.
The best formula or solution would be like:
SUBTOTAL(1, [ Gn in G0:GLENGTH where Gn > SOMECELL ])
Any pointers, or suggestions where to read, or a solution would be awesome. I've been searching on google, and it seems that I lack the right understanding to find the answer in the material presented.
Also, please excuse me for using programmer speak, I know that Excel formulas are not necessarily a 1:1, I'm just looking for a way to save time. Answers in VBA or using Macros are welcome, the main thing is to find a way to do it...
Best,
Jason
Update
I should specify that it needs to be a bit backwards compatible, so I can't use the FILTER function that is only available in >= 365
I'm not at all sure that your attempts at saving time by talking in programming language instead of English really saves either time or space. My best effort determines that you got us all confused. Please tell me why the simple formula below doesn't work.
=AVERAGEIF(G2:G15000,">"&A1,G2:G15000)
This formula requires A1 to hold a number and the formula supplies the > sign. A variation would have A1 contain both, number and comparison, like >1.2`
=AVERAGEIF(G2:G15000,A1,G2:G15000)
The above formulas start the range at G2. Change to G5 if that is what you need. G15000 is a random number intended to be larger than anything you will ever need. The function ignores blanks. However, if you are worried about having a sheet with 16000 rows just on the day you forgot where to adjust the formula I would recommend the use of a named range which you could format to be dynamic.
Named ranges are neater to handle than range addresses and names can be given descriptively, such as HourlyReadings. The above formula would then look like this:-
=AVERAGEIF(HourlyReadings, ">"&A1,HourlyReadings)
Theoretically, the formula by which HourlyReadings is defined could also be written into the worksheet formula but it would become unwieldy. As shown above, you would have to look into the Name Manager to know if the range is dynamic or not but, of course, once defined you can use the same name in many functions and formulas which saves a lot of maintenance time.
This is for Excel 365, using worksheet formulas. With data in column G starting in G5, in another cell enter:
=SUM(FILTER(G:G,G:G>0))
How about an array?
=SUM(IF(G:G>0,G:G,""))
put cursor in 'function bar' with formula. Then press CTRL+SHIFT+ENTER (in that order while holding them all down. {} will appear around formula.
Let me know if further assistance is needed.
Matt
this is a very simple question, but I can not find a way arround it. I am working ona MATLAB project and I need to convert numbers from 1 to 1000 to the written form I.E(one, two, three, four...) since I do not know how to do this in MATLAB I was just going to autopopulate the numbers in MS Excel and import the data directly into MATLAB. My problem is I do not know neither how to autopulate numbers in their written form in Excel since it does not work as I would normally do. I.E :Typing one, two, three, four in separate cells; selcting the values and dragging until I hit 1000. Once I start dragging it just repeats the values over and over. I would appreciate if anyone could help me with this issue either in MATLAB or MS Excel. Thank you
To find the auto-populate lists in Excel, go to Options>Advanced>General>Edit Custom Lists
As you can see below, written form numbers are not included in these lists, which explains why they do not autofill when you drag down.
As pnuts alluded to in the comments, a good way around this in Excel would be to create a custom function that will generate a written form number for any numeral cell value. This has already been done by Microsoft support and is very easy to implement by pasting the code on this link into the Visual Basic Editor in your workbook. (credit to pnuts)
https://support.microsoft.com/en-us/help/213360/how-to-convert-a-numeric-value-into-english-words-in-excel
Once you've done that, you just put your numbers from MATLAB into column A, then paste this formula into B1 and drag down.
=SpellNumber(A1)
I need help with a formula (or macro) please.
On the printscreen below ColA and Row1 are copied in via a macro and cells c2 down and right are formulas.
The problem I have is when Row1 is copied in next time the project names might change (say a new one called "100 Project") and I will need to change the filename in the formulas in C5 onwards.
I don't want to use INDIRECT as I can't have 70 or so files open.
Is there a formula I can use please or does anyone have a macro that'll do the job?
Printscreen
Show us a full circle of what you want to use, what you want to do with it and what the end result should look like. (you can reference the screenshot provided) as I'm not quite clear of want you want to do and don't want to guess.
In any case:
=CELL("filename",A1) should help you with current file name however you rename the document you work on.
Other than that you can import however many filenames you have on a list without needing to open them. We will expand on that should it be needed.
PS Based on updated info:
=INDIRECT(CONCATENATE("'",$C$3,"'","!","A",ROW()))
The reference to make that formula work is C3
This is integrated instead of your
" 'g:\it\capex\2015 etc etc tec ... Plan'!$B$20:$B$119 "
C3="C:\folder\[filename.xlsx]sheet name"
(derived by formula or however you want - the result shows the address)
If you want to put in the sheet name independently or more flexibly simply add one more ,references for it to the concatenation.
Either adjust the formula to accommodate your C3 or adjust your c3 to accommodate the formula its fairly simple = you can do it more easily when you remove the INDIRECT and see what remains as text. Get the correct text running through that and you can need correct reference. You can use the general idea to create dynamic address lists that you can reference from 1 location. Further more vba can pull names from directories so you can compile an active list, leaving you with little to no manual work... Yes - most people usually frown upon crafting location addresses in formulas and usually tell you to reorganize your work files, but some times its necessary to access files ad-hoc on value based references.
I have individual cells in excel with the following content in each of them
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg|http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg|http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg
This is one cell in a long row for a dump of data for products within an ecommerce site. A data migration has somehow added the same image more than once to the same product. Each separate image image is separated by the Pipe "|" symbol.
I want to search each cell in this column of the sheet and remove the duplicated image reference and the Pipe symbol.
So the examples above become
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/m1423.jpg
and
http://www.teng.mossdemo.com.au/wp-content/uploads/images/products/rt2899.jpg
The suggested answer of finding the pipe with SEARCH is a good general answer, however in this instance as the source string is always twice the length of the desired we can just chop it in half with the formula below and drag it down.
=LEFT(A1,(LEN(A1)-1)/2)
In addition to a formula, you can use Data>Text to Columns, which is a good thing to know about. Select the entire column and then you up the dialog. In step one choose "Delimited" and in step two choose the pipe symbol:
When you're finished, delete the first column.
I figured out that this works for some more complex scenarios. I think it should work for this one as well.
=IFERROR(LEFT(C2,(FIND(LEFT(C2,20),C2,2)-2)),C2)
I entered this into D2 and copied it all the way down the column. I then copied and pasted the values back into Column C.
The problem I had was that not all of the cells in my column had duplicate text. Of those that did, the duplications were not delineated by any unique character (There was a single space in front of each duplication.), and the duplicated text was often an incomplete duplication so the length was not consistently symmetrical.
The "20" is an arbitrary number of characters I picked for excel to use from the front of the text to identify where the text started to repeat. There are enough people here who know excel better than I who can explain what the rest of the formula does. I figured it out by poking around.
I have a system where I enter a code in one cell and in the next cell the corresponding text appears, using a lookup table.
Cell 1: I put "W1"
Cell 2: "Make sure that both your opening and ending are interesting and engaging." appears automatically.
Of course, I can't then edit the text. If I try, I find I'm editing the lookup formula.
What I'm really trying to do:
I'm a teacher, the codes are target codes and the text is the actual advice to the pupil. We have a standard system of targets, but we tend to customise the text in different ways according to the pupil.
Am I doing this the most sensible way? Is there a workaround?
Many thanks.
Perhaps it's not you're looking for, but try the following:
Put all grades in the column 1 (corresponds to your cell 1).
Apply Lookup formula and get default answers - this for the column 2.
Now copy entire column 2 and paste special it as values to the same place.
After the above you'll get default grades as TEXT ready for your editing.
Please respond in comments in case you have some more not obvious (from the initial request) limitations.
This requires, as far as I understand it, VBA. Thanks to those below for helping me figure that out.
The answer is here:
VBA Lookup and insert on cell change