As the title says, how do you split this
into
Not sure where the VLOOKUP comes from in your question, but if you have Excel 2010 or later you can do this through PowerQuery
Select your data
Data tab > From Table/Range
You have headers, so choose accordingly
PowerQuery should now start, and within the opened tab:
Start tab > Split column > by delimiter
Obviously choose a comma as delimiter > Choose Advanced and tick by Row instead of Column.
Choose no quotes and confirm.
Right click the data in PQ > Transform > Trim
That's it. You can close PowerQuery now and save your changes
I would post the M code, but my Excel is in Dutch so no use.
If you are not dealing with a massive amount of data, and using Excel 365 or later versions, you can try the following solution.
Suppose your original data is in range A1:A4 including header,
Highlight range B1:B10, go to your formula bar and enter the following formula and confirm it by pressing Ctrl+Shift+Enter on your keyboard:
=FILTERXML("<a><b>"&TEXTJOIN("</b><b>",,SUBSTITUTE(A1:A4,", ","</b><b>"))&"</b></a>","//b")
If you do not want to show the #N/A error, you can use the IFERROR formula in the following way:
=IFERROR(formula,"")
For the logic behind the use of FILTERXML function, you can give a read to this article: Extract word by position using FILTERXML()
The problem with the above solution is that you need to find out what is a reasonable output range for you to enter the array formula so all output can be displayed.
If you have joined the "mysterious" insider program of Excel, you may be able to simply use the UNIQUE function in the following way to get the list (please note the following is only a guess as I am not in the program so cannot test it out).
Highlight cell B1, enter the following formula, hit Enter key as normal.
=UNIQUE(formula)
And the list will be spilled automatically in range B1:B6.
A problem with this formula is that it will only display duplicated values once. Use it with caution.
An alternative is to use SORT function which will also generate a list automatically including duplicated values but they will not be in the same order as the original list if the original list is in random order.
Related
I'm having trouble phrasing my question, so here's a screenshot. Basically I want G2 to be a field I can copy and paste into a field on a website for billing purposes. The TEXTJOIN function is the closest I've gotten to making this work but it still isn't right. I'm having the following problems:
The price of each fruit loses its ending 0's during concatenation
I intend to keep adding more fruits, but =TEXTJOIN(E:E) includes E1 which is obviously the heading
The resulting string in G2 isn't copy-and-paste-able without first copying and selecting Paste Value within Excel
Screenshot for reference:
I might not be able to avoid the last problem without VBA but I'd like to at least navigate around the first 2 issues. I suppose creating a button that would output G2's value to a Notepad document would work as well, or something along those lines.
In E2 put:
=A2&"("&TEXT(D2,"$#,##0.00")&")"
to do the concatenation.
Then just specify the start in E2:
=TEXTJOIN(", ",TRUE,E2:E1040000)
Also you can skip the helper columns with the following array version of TEXTJOIN:
=TEXTJOIN(", ",TRUE,$A$2:INDEX(A:A,MATCH("zzz",A:A))&"("&TEXT($D$2:INDEX(D:D,MATCH("zzz",A:A)),"$#,##0.00")&")")
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
When you copy a cell to the clipboard and paste it anywhere but Excel it should only paste the text, but that may depend on the website also.
Preferring not to use any macros...
I'm trying to build a formula to be able to search for a specific value within a number of different columns. See mock up.
Desired formula picture:
In the yellow boxes I'm searching for a specific number, and to the right I'm wanting to return the heading that value belongs under.
I've tried using a formula including index, small, search but my experience with arrays is not great.
Any thoughts?
Attaching a picture of the formula I'm using now (only including 3 months). I really don't the way this formula is set up because the data import is not easy to replace. I want the data to live in the columns.
Working, bad not desired picture:
Alternatively, if this formula cannot be done, is there any easy way to convert the data from the desired picture into the format of the not desired picture?
Try this Array Formula which requires confirmation with Ctrl+Shift+Enter instead of Enter alone.
In B14
=IFERROR(INDEX($B$1:$M$1,SMALL(IF($B$2:$M$11=$A14,COLUMN($B$1:$M$1)-COLUMN($B$1)+1),COLUMNS($B14:B14))),"")
and then copy it across and down.
I'm trying to use formula to copy data from one worksheet to another where a column matches a certain value.
To be more specific, I want Working!A2:E100 to contain Data!A2:E100 but only for those rows where Data!C2:100 contains the value "Fixed".
Doing this with leaving blank rows is simple, I just create the formula:
=IF(Data!$C2="Fixed", Data!A2, "")
And copy that formula across all the cells.
But then I thought I'd get clever and have it not copy across blank lines, and entered a maze of unclear excel tutorials and vague error messages.
I've created this formula:
=INDEX(Data!A2:Data!A200, MATCH("Fixed", Data!$C$1:Data!$C$200, 0))
And entered it as an array formula using ctrl shift enter.
However all I get is the contents of Data!A2 repeated over and over in every cell of my spreadsheet.
Does anyone need to know what I need to do to make this work?
This is my attempt at a local prototype following the example in BruceWayne's answer, the results are visible:
As you can see "Row 2" just appears repeatedly in the result column. Excel doesn't seem to have an easy way to see what version it is any more but this seems to be a pretty recent one, it's got the ribbon with the file menu and all menu headings are capitalized.
Here's a formula you can use (note: enter this as an array):
=IFERROR(INDEX(A$1:A$200,SMALL(IF(C$1:C$200="Fixed",ROW(A$1:A$200)-ROW(A$1)+1),ROWS(A$1:A1))),"")
You may need to tweak the ranges, I think I got them to match yours, but again, probably need to tweak. You can then drag this down, and it'll fill in with the values from column A, skipping any blanks.
Edit: Here's a screenshot to (hopefully) help show what I did:
You can edit the ranges, naturally, to be over two sheets.
To clarify, A$1:A$200 is the range of what you want to return (the index). C$1:C$200 is the range that holds "Fixed".
I am trying to prep some zip codes to go into the WHERE clause of a SQL query:
WHERE [Zip_code] IN ()
To do this I put all the values into Excel and want to concatenate the zip codes with an apostrophe at the beginning and an apostrophe, a comma, and a space at the end so 99508 would become '99508', . So I wrote the equation
=Concatenate("'",D2,"', ") where D2 is the zipcode. It worked for the top row producing '99058', but when I filled down it still showed the value for D2
To make matters more confusing, when I click on the cells and see the formulas, they are tracking the proper cells but still show data for the top row
I have tried everything that I can think of to solve the problem: reformatting everything as text, formatting the zipcodes as Numbers rather than text, putting the text in the adjoining columns (C2 has an apostrophe, D2 has the Zip code, E2 has apostrophe, comma, and space) and concatenating, using & instead of concatenate ("'"&D2&"', " ), concatenating A on the front and B on the end to do a find and replace, but I still get the same result. If I select a concatenated cell, click on the formula bar, and press enter the cell shows the proper concatenation, but I would rather not do that for every single cell.
My co-worker suggests including that the zip codes were taken from pivot table outputs.
Any suggestions?
Turns out that calculations had somehow been set to manual instead of automatic.
Switching back to automatic solved the problem.
use this instead
=concatenate("'";D2;"',")
idk if gonna work on you sheet, bc i have in spanish my MS-office suite
but if doesn't work, replace the ; for ,
if you copy the formula to the other cells, this must change to the next row
First is clear the worksheet format
secondly, click on file on the excel, then to option, to formula after formula, check the position of the calculation. if its in automatic change it back to Manual and then change it back to automatic. That will solve it.
I've sorted a chunk of data into sub-totaled fields using the Subtotal tool under the Data tab. However, you are only able to choose one formula to apply.
How can I apply a separate formula to one of the columns based on SUBTOTAL(1,RANGE)? So far I have populated it with Subtotal (9,RANGE), but is there a quicker method to select all of these and change the "9" to a "1"?
Select the column.
Press CTRL+H.
Find What: SUBTOTAL(9
Replace with: SUBTOTAL(1
Click Replace All
Assume your formulae are in the range A1:A5
Open up the VBE by hitting Alt+F11, and enter the following code in a general module of the same workbook
Function GetFormula(Cell As Range) As String
GetFormula = Cell.Formula
End Function
I have got this code from http://dmcritchie.mvps.org/excel/formula.htm
For instructions on how to insert this code in a module, see the 'Where to put the code' section at http://www.cpearson.com/excel/writingfunctionsinvba.aspx
Now, you can extract the formula. Use this formula in a helper column, say column B
=SUBSTITUTE(GetFormula(A1),"(1,","(9,")
Now copy this formula upto where you need, and copy-paste values only back where required.
You can also use this trick to modify any other formulae you need, so I suggest you keep this snippet of code handy :)
Change first or last cell then copy it
select all other cells(you can use Ctrl+Shift+up, down, left or right) then use past special and chose formulas