I have a the following table, it has more columns and is 40 rows long
but this is an example of the data. The table is sorted by Team #
Data Table
I am trying to create a 2nd table that shows the top 10 teams that
delivered gears. I want to do this for the other columns as well.
I am trying to do this without VBA.
I used this function and it worked well:
=INDEX(TT_Team,MATCH(LARGE(TT_Tele_Gears,$A3),TT_Tele_Gears,0))
The problem is the duplicate data for the amount of gears delivered
IF two teams have delivered the same number of gears I want to show
them both, but do not care about which is #1 or #2
Currently I get this:
Top 10 Table
Any ideas on a fix ?
Thanks in Advance
You could try a solution like this:
The formula in F2 copied down is just:
=LARGE(B$2:B$12,D2)
and in E2 as shown it's this:
=INDEX(A$2:A$12,LARGE(IF(B$2:B$12=F2,ROW(B$2:B$12)-ROW(B$2)+1),COUNTIF(F2:F$6,F2)))
confirm with CTRL+SHIFT+ENTER and copy down
It's the COUNTIF part at the end that makes the difference. This is counting from the current row, so for duplicates as you go down the column the COUNTIF value changes, so you get each duplicate
Related
I'm trying to make a simple formula for multiple running totals.
Basically, it's for recording transactions for different accounts, showing the running total of that particular account for each row. So, it's impossible to use SCAN+LAMBDA function. One way to do it is to have a set of helper arrays somewhere, but here I'm using another way, by using XLOOKUP.
=C2+XLOOKUP(D2,D$1:OFFSET(D2,-1,),E$1:OFFSET(E2,-1,),0,,-1)
Basically, it looks up the last account balance above the current row of the corresponding account and add the current transaction amounnt to it. It works by draggin down to all the transaction rows.
Since the number of transactions is over 10 thousand, I was trying to minimize the file size by using named function with LAMBDA.
Name: AddtoBalance
=LAMBDA(c,c+XLOOKUP(OFFSET(c,,1),Sheet1!E$1:OFFSET(c,-1,1),Sheet1!F$1:OFFSET(c,-1,2),0,,-1))
And changed cell E2 to
=AddtoBalance(C2)
and dragged it down to all transaction rows.
However, after saving and re-opening, the cells are having errors. I have to go to Name Manager, click Edit but without doing anything and Close it. Then the cells becomes fine again. It seems to me that when re-opening a workbook, the formulas are not calculated sequentially from top to bottom. Is that right? Is there any options to change it?
I think you are going to hate me when you see this…
Put this in E2:
=SUMIF( B$2:B2, B2, C$2:C2 )
Then copy it down. Mind the dollar signs, they are important. You could place this in a named Lambda but the character count reduction is probably immaterial.
After rebooting and restarting excel, actually I could not reproduce the error. It works fine with the Lambda function now.
Whole different approach, but how about:
=LET(f,ISNUMBER(C:C),
c,FILTER(C:C,f),
d,FILTER(D:D,f),
s,SEQUENCE(COUNTA(d)),
MMULT(
(d=TRANSPOSE(d))*(s>=TRANSPOSE(s)),
c))
It first creates an array of TRUE's and FALSE's on column C:C if it contains a number. This is used to filter the values to be used from column C and D.
A sequence of the count of filtered values in column C is used to simulate it's row number in that filtered range.
Now MMULT checks row by row how many values of column D equal it's current value where the sequence number for that "row" is smaller or equal than the current.
I have a recorded drive cycle of a truck which includes speed and coordinates over time. The file looks like this (simplified version)
I want to know the number of times the truck is stopped (when speed = 0) and number them. Therefore, I would like to group the intervals with '0' values (vehicle stopped) in the Speed column and name them in order (Stop 1, Stop 2, etc). Ultimately, my goal would be to somehow be able to calculate the number of stops and duration like this:
Is there any function in Excel which would allow me to do something like that? Thank you.
You can do it using Pivot Tables and a helper column. Also if you have Excel365 with functions like FILTER,UNIQUE and SUMIFS
Formula helper column is just to enumerate properly each group of stops. Notice data need to be sorted properly as your exampel or it won't work:
=IF(D2="STOP";IF(D1="STOP";E1;MAX($E$1:E1)+1);"")
Then pivot table can be inserted:
Helper Column and Vehicle Stop into rows section
Time-step seconds into values section, formated as Time and operation=Sum
Filter field Helper Column to exclude blanks
If you have Excel 365, you can get this output with advanced formulas. In cell J14 formula is:
=UNIQUE(FILTER(D2:D19&E2:E19;D2:D19="STOP"))
And K14 is (and drag down) is:
=SUMIFS($B$2:$B$19;$D$2:$D$19;"STOP";$E$2:$E$19;MID(J14;5;99))
Anyways, I've uploaded the workbook to Gdrive so you can see the Pivot Table and the formulas by yourself. If you don't jave Excel 365, the formulation part may give some errors when you open it:
https://docs.google.com/spreadsheets/d/1t1INxGKJRHFexWnSC5LlIi37JrThjajs/edit?usp=sharing&ouid=114417674018837700466&rtpof=true&sd=true
Just as a postscript to this, you could do the same thing without using helper columns by comparing offset ranges to see where the transitions in speed occurred from 0 to 10 (go) or 10 to 0 (stop). The problem is that normally you would have to go outside the data range (a2:a16 and c2:c16) which gets you either a header cell (a1 or c1) or a blank cell (a17 or c17). In the case of time, there is also a special case where the first time-step is taken to be zero.
All this can be avoided in Excel 365 by using vstack to add appropriate dummy values to the beginning or end of the two ranges:
=LET(timeRange,A2:A16,
speedRange,C2:C16,
timeRange1,VSTACK(A2,timeRange),
speedRange1,VSTACK(1,speedRange),
speedRange2,VSTACK(speedRange,1),
startTime,FILTER(timeRange1,(speedRange1>0)*(speedRange2=0)),
endTime,FILTER(timeRange1,(speedRange1=0)*(speedRange2>0)),
stopTime,endTime-startTime,
label,"STOP "&SEQUENCE(ROWS(stopTime)),
HSTACK(label,stopTime))
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
I'm stuck on an Excel problem and am hoping someone can assist. I read through 10-15 topics that are similar, but I wasn't able to get anything to work. Here is where I'm at...
I have a large data set containing columns for Year, Name, Total 1, Total 2 (and 20+ other columns). The same names appear in multiple rows based on the yearly totals. On a separate sheet, I have another data set containing Name and would like to pull the data from sheet one into columns as shown below.
I have done this in the past using only one year as the initial data set with the following formula:
=INDEX(DATARANGE,MATCH([#Name],DATARANGE[Name],0),MATCH("Total 1",DATARANGE[#Headers],0))
The problem I am having is the result of adding multiple years of data to my 1st data set. Is there a way to match the row based on name and year and then return the results of the appropriate column?
=SUM(($A$2:$A$9=B$16)*($B$2:$B$9=$A17)*($C$2:$C$9))
Enter above in cell B14 as an array formula or below as standard
=SUMPRODUCT(($A$2:$A$9=B$16)*($B$2:$B$9=$A17)*($C$2:$C$9))
You can do the same for total 2 just replace Cs with Ds
And then drag right and down.
Change the first MATCH function to something like this:
=MATCH(1,INDEX(([#Name]=DATARANGE[Name])*([#Year]=DATARANGE[Year]),0),0)
so as part of your whole formula that would be this
=INDEX(DATARANGE,MATCH(1,INDEX(([#Name]=DATARANGE[Name])*([#Year]=DATARANGE[Year]),0),0)
,MATCH("Total 1",DATARANGE[#Headers],0))
Another way you can use for returning numbers only (as here) is like this: (with cell refs for simplicity).
=SUMPRODUCT((A2:A9=2013)*(B2:B9="name x")*(C1:D1="Total 1"),C2:D9)
If the presented data to be indexed is a table then
This
=MATCH(1,INDEX(([#Name]=DATARANGE[Name])*([#Year]=DATARANGE[Year]),0),0)
should be corrected to a proper structured reference of
#[Name]
Also since this is an array formula it may not work with structured references at all. You'd be better served with regular cell references. Also if it is not a table only cell references will work.