Here are some statistics about my question(related to excel 2007)....
some thousands lines of data from web (so highly unstructured)....
Each row acting as a tuple ..(each row has data related to a particular entity with various attributes)
there are about 60-100 attributes for each row... i.e. some row has 60 attributes(followed by corresponding attribute value in next cell of same row) while some has 100 attributes(values)
These attributes are not structured and not in any particular pattern..(i.e. in some row Attribute "Music" is at column "A" and its associated value is at column "B" but in other row ,Attribute "Music" is at column "AB" and its value is at "AC"....
So here is my question
Is there any tool/excel utility which can group all attributes of same name under a particular column and its associated value in the next column .[IMP: the row order must not be changed as these attributes are associated row wise with some primary key]
This is a very broad question but I can give some suggestions. I don't know of any tool/utility to do what you need. However here are three options that you could use to get the result you want.
Figure out how to import into a database based on attribute name/value. Not sure this is possible without structuring the data first (organize each attribute into its own column).
Use formulas HLOOKUP/VLOOKUP/INDEX/MATCH to organize each attribute into its own column. No VBA with this option but uses very complex formulas.
Use VBA to loop through the rows and organize each attribute into its own column. This might be the easiest to implement logically but that depends on your skills.
Usually we want to see what you've tried before we help. You can explore each of these ideas on your own then post additional questions for specific problems you encounter. Show us your own effort as much as you can. We like to help correct specific code problems rather than simply create your program for you.
EDIT
Here are the formulas for method 2: The data is in Sheet1 and the formulas are in Sheet2.
Here is the formula in Sheet2!A2; copy down as far as needed.
=Sheet1!A2
Here is the formula in Sheet2!B2; copy down and across as far as needed.
=IF(ISERROR(MATCH(B$1,Sheet1!$A2:$K2,0)),"",INDEX(Sheet1!$A2:$K2,1,MATCH(B$1,Sheet1!$A2:$K2,0)+1))
Best wishes.
Related
I want to count all rows in an Excel table which contain "01.09.2019" in column "D".
First problem: The table is on another sheet
Second problem: Column "D" contains date AND time (e.g. 01.09.2019 00:45:20) but I'm only interested in the dates. I did this with:
=COUNTIF(October_Data!$D$2:$D$299;"<02.09.2019")
This works for me.
But now I want to filter the data and COUNTIF doesn't work with filters.
I found:
=SUMPRODUCT(SUBTOTAL(3;INDIRECT("D"&ROW(2:999)))*(D2:C999<"02.09.2019"))
This obviously doesn't work because the hint to the data-sheet is missing but I really don't know where to use it. Besides of that I tried to rewrite the formula so it fits my needs but I don't really know if I made any mistakes because I have problems understanding the formula.
Here is an image for you:
example table
The data is private so I had to make an example:
Column A is filtered by "a". Now I want to count every row which contains "01.09.2019". In this case it would only be one.
But remember: This table is part of the sheet "October_Data" and my calculations happen in another sheet!
From HERE. With the necessary modifications:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(October_Data!$D$2:$D$299,ROW(October_Data!$D$2:$D$299)-MIN(ROW(October_Data!$D$2:$D$299)),,1))*(October_Data!$D$2:$D$299<DATE(2019,9,2)))
With your local setting you will need to change the , for ;
The situation: I have an automatic procedure for gathering data from different input-sheets and presenting in a pivot-friendly format. It appears others are in need of the same data, though they want it formatted slightly differently (and they are not friends with excel). I therefor have a version of my table formatted as they want it (with empty columns where my extract does not contain any data).
The table (both) is one line for each department for each year for each cost/income (from now, cost) category. The raw data contains the cost for each year, though some of the users want it to be cost delta from initial year. I want:
One column for raw cost (X). One column for delta cost (Y). One output column (Z) that contains one of those two values, depending on dropdown selection. The first two columns are situated to the right of the "select with mouse and copy these"-columns, so that I dont need to teach the other users how to select non-adjecent columns :P (just letting u know the level of understanding i have to work with here)
Now the naive approach to this would be to have an if-statement in column Z like this:
=IF(selected_Calc="Use raw cost";[#[X]];[#[Y]])
Alternatively nest more ifs (one for "Use difference to 2019", and potentially add more nesting if more ways to show the value should appear in future)
This works. However, it isnt as elegant as I would like it, and if I indeed end up with more ways to calculate this for other people, it will be a lot of nested ifs.
I was therefore considering something like this:
=INDIRECT("[#["INDEX(mapTab_out;match(selected_Calc;mapTab_in;0))&]]")
But this gives a #ref, and tbh i didn't really expect it to work.
The idea is though: .
Have a range mapTab_in. This has the different selections for the dropdown box.
Have the adjecent range mapTab_out. This has the name of the column (X,Y...) that contains the desired calculation)
Have in column Z a formula for selecting which column's (X,Y...) value is to be displayed in Z
The google-stuff I have found so far all seem interested in using the indirect function from outside the table, and usually want to sum an entire column. I have used this in the past. The "ThisRow" things like using # dont seem to work with indirect though. Any ideas, or have I simply made some beginner-error in my formula?
Assuming it's in the same table, you can take advantage of implicit intersection and simply use:
=INDEX(Tablename,,MATCH(selected_Calc,Tablename[#Headers],0))
where selected_Calc is the name of the column you want back. (You could make that the result of a further INDEX/MATCH if you want to use a lookup table for some reason.)
I'm trying to fill in a table using data from another table. I've researched the VLOOKUP function, and either I don't fully understand it, or it isn't the right tool.
For example, let's say I have a column of data that is of the format: (p53, chk2, stra8-cre)
From this column, I want to extract any row (the entire row) that has 'chk2' in it. What tool can I use for this?
Thanks
From what I'm understanding, you're trying to have a formula in one cell that sets the content of all cells in its row. As far as I know, you can't do that without some sort of macro.
My suggestion would be to have a similar formula in each of the rows you want to set.
EDIT:
Use SEARCH to help with this problem. Look here on how to use it for this case.
Ex:
layout in CSV format:
p53chk2,a2,a3
chk2,b2,b3
stra8-cre,c3,c4
formula:
=IF(ISNUMBER(SEARCH("chk2",$A1)),B1,"")
Copy this formula across all cells in the row, and the contentshould be applied the subsequent cells.
Hope this helps, let me know if this isn't exactly what you were looking for.
I am trying to create code that will help me achieve the correct format. All I want is to pull employee (EE) entire row and paste into a new sheet, and then second part (ER) value to match the same employee.
In other words, if employee pay pension contributions for 100 (Pen EE (Tal)) and employer pay for 200 (Pen ERS (Tal)) on behalf of the same employee. Then, the worksheet should look like Column A= Pers No, Column B=Employee Name, Column C= ID Number, Column D=PenPay, Column E=Pens EE(Tal) and Column F=Pens ER(Tal) and G= Total (Pen EE +Pen ER values), as exactly in example tab.
I hope this makes sense. I have tried several methods but no luck so far. Thank you all for your help.
From your problem description, I think I can decipher that you are using Excel.
I see three basic approaches to solving your problem:
The simplest approach is not to use VBA at all and instead use the workbook functions INDEX and MATCH. The latter returns the row or column where an exact match is found in the search range, which has to be one dimensional. (The exact match actually requires the search option 0.) The function INDEX returns the value at the given row and column in a range. Combining both, you get a more flexible verision of VLOOKUP and HLOOKUP, which you can use to find the values in the second table for a given employee. (MATCH returns an N/A error if no match is found.)
The second approach is to use the Excel object model in VBA. You can search a range for a value using the Find method of the range. This returns the cell where the match is found and Nothing in case there is no match. If the search result is not Nothing, you can use the EntireRow property to get the entire row and the Cells property to select cells in the row.
Finally, you can use the support of SQL for Excel via ADODB. For a description how to do this, you can look at this Microsoft page and this old question on SO. Provided you know how to write SQL queries, this should enable you to solve your problem via SQL.
My table has a date column to to the left (Column A). Other columns have share quantities and values. Using standard VLOOKUP, I can retrieve values for a given date.
However: I have new transactions, which regularly need to be added to the master table. What I need is an "inverse" function, that allows me to append (or even over-write) data to the underlying table.
So far, my searches for an "inverse" function only give me alternate ways to retrieve (with the columns out of order). Any suggestions for an appropriate method?
If I understand you correctly, what you are looking for is a script that can add data to the end of a table, or change data on an existing cell. Functions only work by reading data in other parts of the spreadsheet and outputting the result in the cell that they were written in. I don't think you're going to find a formula that sends data to another part of the spreadsheet.
If a script is what you're after let me know. I use scripts like that so I can code a few code snippets.
Please check INDEX MATCH functions.