My original data looks like this:
I want my data to be transformed into:
Is there any way that we can do this without using pivot/subtotals. The reason why I am against pivot/subtotals is because i want to merge this data with some other data and do some calculations. VBA holds good too.
Any ideas please? I do not want the entire solution here, just suggest me some idea to proceed. I did a bit of research and all those were just the pointers to Pivot/Subtotals.
What have you tried? Please share your code/research.
For the "Total Effort" try:
=SUM(IF(B$2:B$9=G2;D$2:D$9))
And hit CTRL+SHIFT+ENTER when editing the cell value. Then drag it down.
Where "G2" is the "Name" value. "B2:B9" is the "Name" column and "D2:D9" is the "Total Effort" column.
Other columns:
To get the other columns you need to get the unique values. Try this for the ID column (assuming you want the unique IDs in Column F):
=INDEX($A$2:$A$9;MATCH(0;INDEX(COUNTIF($F$1:F1;$A$2:$A$9);0;0);0))
And hit CTRL+SHIFT+ENTER when editing the cell value. Then drag it down until you get #N/A values.
Where "A2:A9" is the "ID" column. "F1:F1" is the new column with the unique "ID".
I do this all the time for sundy data munging, you can connect to the workbook using ADO and run a SQL groupby statement on the sheet.
If you don't want to use VBA then you can do the same thing with microsoft query, though its a bit clunky using Data> from other sources > From microsoft query (data source = excel file).
For an easier query builder you could just import your table into Access and run a groupby query there, then copy paste it back.
Related
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'm having a very difficult time with transitioning my VLOOKUP statement from simply referencing sheets and ranges (which work like a charm), to instead using table and column names.
I'm trying to make the VLOOKUP a bit more robust as the sheet where it is pulling from will constantly be changing data, so column numbers will change frequently. Thus, I'd like to just reference a column by its name.
I have converted the source data sheet to a table.
I have named all columns appropriately and double checked spelling.
This VLOOKUP works great (currently):
=VLOOKUP(E6,'Costs'!$A$2:$AE$84,19,FALSE)
However, what I would like to do is make it look this:
=VLOOKUP(E6,tblCosts[Order Number],tblCosts[June 2017], FALSE)
I have been fiddling with also trying to use MATCH which is not working either:
=VLOOKUP(E31,tblCosts[Order Number],MATCH(F4,tblCosts[June 2017],FALSE),FALSE)
UPDATE
This formula now works but it is returning the order number...not the cost for the month.
=VLOOKUP(E31,(tblCosts[Order Number]),(tblCosts[June 2017]),FALSE)
Normally I would keep trying this myself...but I am feeling overwhelmed and have been trying for hours. Any advice would be great.
Thank you!!
This should work for you:
=VLOOKUP(E31,tblCosts[#All],COLUMN(tblCosts[Jun-17]),false)
The COLUMN(TblCosts[Jun-17]) returns the column number of the field you want.
The VLookup searches the first column of tblCosts[#All] - (all the data in the table) for the data (in E31) and returns the data in the column you want.
This formula will continue to work even if you add columns or rows to the data.
Make sure that any heading which looks like a date in your spreadsheet eg "Jun-17" is stored as Text and not as a Date, as it will not match the string "Jun-17" when you use VLookup.
=VLOOKUP(E37,tblCosts[#All],match("Jun-17", tblCosts[#Headers]),FALSE)
This match is looking for the column name in all column headers and will return the number of columns to the right of the first column rather than the column number in the sheet. This avoids having to use COLUMN(tblCosts[Jun-17]) - COLUMN(tblCosts[Order Number]) + 1 when your table doesn't start in column A.
Ref: https://www.excel-university.com/vlookup-hack-4-column-labels/
I have been working on a solution to this problem for a few hours now and I am basically no where except knowing that I don't know how to do it...So here goes.
I want to take the original data that I have in Excel that have 'code#s' for each 'category#'. With those 'code#s', I can look up the 'category#' name.
This has been so challenging because there are a varying number of categories for every 'title#'.
I have tried printing the 'category#' name next to 'title#', but it is seemingly impossible because Excel goes through every row in the original data and gives a True, False or #N/A instead of selecting and printing only the true statements without copying down a thousand rows. I want it to go through all the possibilities and only select the categories based on the criteria that they have the same 'title#' and their lookup code matches somewhere in the lookup table.
Thanks if you can offer any sort of help.
Here are some of the formulas I have tried:
IF(AND($M$5=TOP_TREND_CONTRIBUTORS!$W$2:$W$253,MATCH(TOP_TREND_CONTRIBUTORS!$A$2:$A$253,'Category Lookup'!$D$3:$D$30,0)<>"#N/A"),TOP_TREND_CONTRIBUTORS!$A$2:$A$253,FALSE)
....where M5, W:W is the 'title#', A:A is the code for the lookup-in that part I am trying to say that they are valid if the code registers in the lookup table and the 'title#s' are equal. The last part I am trying to get it to print the 'code#s' that are valid. But that only works when I drag the formula down all the rows.
Maybe I'm missing something, but I just tried to get from your original data and lookup table to the final result. I used VLOOKUP to put categories next to titles and then used pivot table to present the data in the way you wanted (after changing some settings of pivot table and fields). Is that what you need? (some words are in Polish, it doesn't matter).
Apology if this question has been answered before. In the Summary column I would like to calculate total values for each UserID, excluding Fee which is always 19. As you see there are duplicate UserID's.
I was thinking of using SUMIF'S something like...
=SUMIF(Value, Name,<>"Fee,<>
then I couldn't get it right.
So for example UserID 4836344 total value would be 97.83.
What formula should be used to solve this problem.
Thanks in advance if anyone can help me.
P.S - Let me know if you cannot see the image below.
I would just add another column EffectiveValue that would contain effective value that needs to be added to the total sum. Formula for that column would be something like '=If([Name]="Fee";0;[Value])'.
Then I would sort table by UserId column.
After that I would use Data -> Subtotals feature to produce total sum per user. In wizard you would specify that on every change in UserId calculate sum of EffectiveValue
Sorry if there are syntax mistakes & formatting, but I am writing from mobile phone.
You got your SUMIFS formula almost right. You just need to include the <> within the quotation marks like so:
=SUMIFS($E$2:$E$19,$A$2:$A$19,A2,$D$2:$D$19,"<>Fee")
The above assumes that your sample table starts at A1 with UserID and continues through column E with the values. The above formula would go into cell F2 as the first summary and should be copied down. Keep in mind to adjust the range to include more rows (here only through row 19).
If you have the above sample as a table then you can also use the following formula for F2 and Excel will automatically copy it down:
=SUMIFS([value],[userid],A2,[name],"<>Fee")
To convert your table to an "Excel recognized table" select the entire table and press Ctrl + T as described in more detail on Microsoft's website.
For more information on "Tables in Excel" you might want to read the following articles:
Overview of Excel tables
Use Excel tables to manage information
As seen below, I have an excel file where collections from debtors is recorded.
Column A is the staff code who made the collection..
Column B is the date of collection
Rest is self explanatory
Out of this table, on a different sheet, I need to extract data from this table and populate a new table with the filtered data. E.g., On the second sheet, I need a table to show collections from only P102, of which I have managed to do with the below array formula:
{=INDEX(Sheet2!$A:$A,SMALL(IF(Sheet2!$A:$A="P102",ROW(INDIRECT("1:"&COUNTA(Sheet2!A:A)))),ROWS(Sheet2!$A$2:$A2)))}
Of course this code outputs only the Personnel code but I've ammended this to show for other columns too..
The thing I can't manage to do is, I also need to apply a second filter with the date.. Eg. Only those records from P101 and only in February..
I would really appreciate any feedback on this...
P.S. I do not wish to use Macros and No, I can't make a pivot table...
Regards,
Kemal
Personally I'd approach it using an array formula with logical conditional multipliers. Very similar to SUMIFS.
Here's the output I understand you require:
Here'e the array function (shift + ctrl + enter) I've used placed in cells G2:G5:
={SUM(IF(Table1[Personel]=E2,1,0)*IF("2014"&VLOOKUP(F2,{"Jan",1;"Feb",2;"Mar",3;"Apr",4;"May",5;"Jun",6;"Jul",7;"Aug",8;"Sep",9;"Oct",10;"Nov",11;"Dec",12},2,0)=TEXT(Table1[Date],"yyyym"),1,0)*Table1[Cash])}
Please indicate if there is anything further outstanding.
Kind regards,
James