I have been given an excel spreadsheet to convert to csv. The problem is that one of the fields is a description field in which in sentence in the description is on a separate row. So for example the first product is on row 1. The first line of the description is on row 1, the second line of the desription is on row 2, with all the other columns in that row empty. Most products have about 6 rows of description. The next product then starts on, say row 7.
I have tried exporting the data but naturally excel creates one line in a csv file per excel line so most of the rows are empty rows with just one sentence of description (e.g. , , , "sentence 2", , )
Please can you advise if there is a way to handle this?
Thanks
One way to deal with this is to get all of the description lines into a single cell in the same row as the rest of the fields, and then get rid of the mostly-blank rows that just have the extended descriptions.
Lets assume your spreadsheet has product information in columns A and B, and the description fields in column C, like this:
In D1, enter the formula
=C1
In D2, enter the formula
=IF(A2<>"",C2,D1&"/"&C2)
Fill this down the rest of column D, producing this:
For each item, column D now contains the full description on the last row for that item. Now we're going to get that value back up into the row with the rest of the data fields for the item. In E1, enter the formula
=IF(A1<>"",OFFSET(D1,MATCH(TRUE,LEN(A2:A20)<>0,0)-1,0),"")
Hit Control-Enter to enter it as an array formula, and then fill down the rest of column E, producing this:
You need to enter one extra value after the last row (the "End" in the image above) to make this work. Now you have the full description for each item in column E. Copy column E, paste values, sort by column E to group together all the blank rows, and get rid of all the rows that don't have values in column E. You can get rid of columns C and D at this point if you want to, which leaves you with this, which you can now export to CSV:
There's a small spreadsheet that illustrates this at http://www.filedropper.com/multiline
I'd suggest to export one line per product with whole description in one place. Let's say you have a product name in column A and product descriptions in column B. You can put all descriptions in one cell with this formula (this formula assumes that you start it with cell C1):
=IF(ISBLANK(A2);B1&C2;B1)
Drag this formula till the last row, copy-paste as values (copy column C and paste it as values) and then delete "empty" (by column A) rows. Here you have one row per product with description in one place.
Related
Maybe I'm using ´VLOOKUP´ wrong, but I've tried even using a table array. It continuously returns a ´N/A´ or ´#REF´ error back to me.
The spreadsheet is setup with a sheet titled 'Character', ´C6´ is a drop down menu, and ´D6´ is where the ´VLOOKUP´ formula is being written. I have a 2nd sheet listed named, 'Weapon', which is a 13 row sheet with various different text and numerical data information. I'm only trying to pull the numerical data from the 6th row, or column F.
So, this is the function I'm writing:
´=VLOOKUP($C$6,Weapon!$A$2:$M$78,6,0)´
What's odd about this is if I check
´=VLOOKUP($C$6,Weapon!$A$2:$M$78,1,0)´
It will return the text data of the first result in the A column on the 'Weapon' sheet, but it won't return anything else in B,C,D,E,etc. columns if I change that 1 to a 2,3,4,5, etc.
Any insight would be great.
For VLOOKUPs to work, it's the lookup value that is the critical part. And that critical part has to be unique and it has to be in the first column. Your table of data on the Weapon sheet has "Staff" in Column A.
A quick fix for you is to change your formula to
=VLOOKUP($C$6,Weapon!$B$2:$M$78,5,0)
Notice the left-most column of the range is now column B and we're getting data from the 5th column.
This assumes that your values in column B are unique and will match up with the values in your drop-down menu in C6 on the Character sheet.
I have excel sheet with 500 rows and more than 10 columns. The first column is subject id.
And I have list of subject id approximately contains 2000 id. The 500 id in the spreadsheet is subset of the external 2000 id.
I want to arrange the spreadsheet rows according to the external list of ids.
Edit:
I have spreadsheet 'A' of 500 rows
and spreadsheet 'B' with 5000 rows
I want to edit spreadsheet 'A' by place its rows at the same position (row number) of its occurrence in 'B'.
In other words, you can see from above pictures that:
First subject of 'A' '2196978' is located in row number 2 in 'B'. My task is to put '2196978' of 'A' in row number 2
Second subject of 'A' '2219364' is located in row number 9 in 'B'. My task is to put '2219364' of 'A' in row number 9
and this is done by insert rows in 'A' if the subject of 'B' is not exist in 'A'.
This result is what I want:
Without resorting to Macros I don't think what you want to achieve is possible, however it is possible to get something very close. The core issue is that a function cannot create rows so you have to start with the number you want to end up with.
I my proposal you end up with a 3 Book solution. Book A with 500 rows, Book B with 2,000 rows, and Book C which is the result also with 2,000 rows but many of them blank.
You would start by creating Book C with a complete list of IDs from Book B i.e. all 2,000 of them. This could be a copy and paste or you could assign them using the Excel = function. For this example put them into column "A".
Next we want data to appear only if it is in Book A. We do the lookup using VLOOKUP() and if the data is missing we get a #N/A error.
So before things get complex in column B of the new Book add the formula:
=IF(ISNA(VLOOKUP(A1,[BookA]Sheet1!$A$1:$A$200,1,FALSE)),"row missing","row there")
This will return a text message indicating if the row exists in Book A and will be used as a flag to display the remainder of the data.
Check this works and if it does change it to:
=IF(ISNA(VLOOKUP(A1,[BookA]Sheet1!$A$1:$A$200,1,FALSE)),FALSE,TRUE)
We now want to get column B, C, D etc. from Book A based upon the True/False flag we have created. So column C in the new sheet is something like:
=IF($B1,[BookA]Sheet1!B1,"")
If you have the $ signs in the right places is should copy and paste nicely.
You have 2 options for improving this and getting nearer your objective.
Embed the initial lookup in the 2nd IF statement
Use conditional formatting to turn the text white if it should not be there (including the ID)
I have not done either of these because it is un-readable and is basically write once code that you can never modify without starting again.
Good luck.
You have to use the below formula in spreadsheet B which contains 5000 rows,
=IFERROR(INDEX(SheetA!$A:$J,MATCH($A2,SheetA!$A:$A,0),COLUMN()),"")
This is a simple INDEX - MATCH formula which looks up values in SheetA matches it with SheetB and prints output in SheetB. Use the formula in SheetB cell B2.
Explanation:
A2 cell in SheetB is matched with A:A in SheetA.
If found, pulls all the column data of that item from A:J from SheetA.
Once you pasted the formula in B2, drag it across all required columns. Then drag the same across all rows or just double click the fill handle, so that the formula is filled for all 5000 rows and data is pulled.
Let me know if you face any difficulties. Hope this helps.
I have a spread sheet of values organized by id number with a column of semicolon separated values.
I would like the spread sheet to be organized by id number with a column for each value and if that value exists for a id number a 1 be placed in the cell and if it doesn't exist a 0 placed in the cell.
Has anyone done this before or know where I should start?
You can try this but you need to keep the original value somewhere and then use this formula:
=IF(ISERROR(SEARCH(C$1,$B2)),0,1)
Your data layout should be like below:
So Column B contains your original data and your new headers starts at Column C.
Enter the formula in C2 and copy to the rest of the cells. HTH.
I have two work sheets. I would like to select a cell in the first work sheet and IF the contents are matched within the second work sheet, take data from that row (in the second sheet) and place it in defined cells in the first sheet.
the column order will always remain the same in both work sheets.
for example.
Sheet 1
Columns = UID, A, B, C, D, E, F, G
Sheet 2
Columns = UID, 1,2,D,E,F,G
I want to select a cell in column 'UID' in sheet 1 and check the column 'UID' in sheet 2. if two items match, I would like to take the data within columns D,E,F,G (for the row that UID row that matched) in sheet 2 and return it to columns D,E,F,G in sheet 1 (for the row that matched).
Sorry if i have not explained it as well as needed.
Many thanks
afraid it always comes back with an error. everything i have read seems to tell me it will only >bring back one value rather than 3 or 4 cells worth
What if you concatenated all the columns into one column in sheet two, using a standard delimiter (e.g. / or # or whatever character isn't in your data). Then do your vloookup. To get the final result use the text to columns tool to un-concatenate the data.
All examples I see they convert text to number but the content is a number in text format. I need to create numbers for emails so I can use that as a unique id.
What I need is to go from: test#example.com to a unique number.
More detail on pnuts solution.
Column A has your e-mails.
Column B has =row()
C1 has =if(iserror(vlookup(A1,$A$1:B1,2,0)),B1,vlookup(A1,$A$1:B1,2,0))
Drag the formula down.
Column C will contain the row number if the address hasn't been listed above, and the row of the first instance if it has been listed. If your emails don't start in row 1 (such as if you have headers or something), then you'll have to edit all the 1's the the first row of your table with e-mails and place the first formula in that row of column c.
So maybe C3 would have =if(iserror(vlookup(A3,$A$3:B3,2,0)),B1,vlookup(A3,$A$3:B3,2,0))
Write below line in any of the cell in Excel
=VALUE("2.0")
This will return the conversion of text(string) to number. Select Function from MenuBar (I think its in Insert tab) for other functions.