Need to convert / transpose from row-based to column-based - excel

Help needed please!
I’m building a parkrun spreadsheet and need help with one column. A friend of mine has a spreadsheet of his parkruns where he has successfully achieved this calculation, but he records them horizontally, whereas as I do mine by column, as per most databases. I have managed to adapt the other columns in my spreadsheet from his example, except for the ‘Tourist Streak’ # one (highlighted in yellow). I just wonder if someone could get this working in my column version please?
The Tourist Streak calculation is defined as follows: The highest number of consecutive different events attended
This one is driving me crazy!
My friend’s row-based version is here
My column-based version is here
Thanks in advance!

I thought I would have a go at this, but ended up using a different formula. The idea is that the countif looks back only to the beginning of the current sequence of unique venues to see if the current venue is duplicated and resets the length of the sequence according to the last appearance of this venue if so (I have used the word 'venue' to avoid confusion with 'run' meaning a sequence).
Starting with 1 in B2, place this formula in B3:
=IF(COUNTIF($A2:INDEX($A:$A,ROW()-B2),$A3)=0,B2+1,
ROW()-AGGREGATE(14,6,ROW($A$2:$A2)/($A$2:$A2=$A3),1))

Related

How to count pairs of cells in alternate rows

I am preparing a weekly time-table for my school which looks like the following
The even rows contains course names, whereas the odd rows contain the teacher initials. Observe that a same paper is taken by more than one teacher (e.g., C10 C11 and G10 G11). I need to count the total number of classes per course per teacher in a week. Please help me to achieve that.
My efforts so far have been very inefficient.
I calculated the formula in B71 for each row in the entire time-table and added all the quantities in B70. However I need to have a comprehensive list of all courses with divisions for all teachers. I am not being able to generate that.
Thanks in advance.
You where pretty close in your attempt. You could use the following in B70 and fill down and to the right:
=COUNTIFS($C$10:$P$67,$A70,$C$11:$P$68,B$69)

Excel - What is the easiest way to calculate incidence plus prevalence over time?

Say I have the dataset below, what is the most efficient formula to fill the cells in column D, where the number of patients alive are calculated?
Example data set in excel
The way it should calculate is:
month 1: 8*100% = 8
Month 2: 8*80%+6*100% = 12.4
Month 3: 8*75%+6*80%+9*100% = 19.8
...
Month 10: etc.
The problem that I have is that which each row, the formula becomes longer. It is feasible to just manually enter the formulas for small datasets, but as datasets become larger, this task becomes unfeasible.
I have been able to use VBA to code the survival of the number of new patients column (C). But then I would have to rerun the VBA code as soon as I change a single value in that column.
I have a feeling it should be possible with some combination of the INDEX function in excel, I just haven't been able to figure it out.
Who can help me out here?
Kind regards,
Sander
If moving the data a bit is allowed at least for the calculation, you could do something like this:
=SUMPRODUCT($F$11:$F$20,B2:B11)
It uses a reversed list of your current list of new patients. That list is created with (formula obtained from this site):
=INDEX($C$11:$C$20,COUNTA($C$11:$C$20)+ROW($C$11:$C$20)-ROW())
Result:
The added space is necessary for the formula to work (so that it gets 0% for patients not present yet).
Or one where you don't have to leave spaces (everything from above is reversed however):
=SUMPRODUCT($C$2:$C$11,G11:G20)

duplicating count or only looking for 1st statement

Link to sample spreadsheet: attendance tracking
The tab to look at is the AM Classes. We need a count of how many students attended a class/group that day but it must be unduplicated. Such as some students may attend more than one STEM class in a day, but how many they attend in one day doesn't matter. We only need it to count the student once for that day in the STEM group. What I have is two different options (G1027 & M1027) but they aren't working correctly. I hope this is making sense. Attendance will be entered in using set codes (different letters of the alphabet- A1027 shows the codes.) What we need to track and their codes are in column C at the bottom (the blue lines.) I was also given the suggestion of having the formula look through the cells in that days column and find anyone of those codes and if it did, to use another column that is filled with 1's to do the actual counting (Column F). I'm not sure how to set that up though.
Thank you so much for looking at this. We have struggled with this for a while now and have had it on google forums and no suggestions on how to fix it. Below is a snapshot showing a section of the sample sheet and what we are struggling with. Thanks again.
screenshot
Try G1027:
=SUMPRODUCT(REGEXMATCH(G4:G1016,"(?i)[aglmpst]"))

Calculating Multiple Averages

It's my first time posting a question to this forum. Though I have found answers here many times before, I have been unable to find a solution to my current predicament.
I work in a call center and each week I need to analyze data from the thousands of call that took place over the week. I'm new to programming in Excel-VBA but I've been able to get pretty far.
The data is produced by a third party program and the format is nigh unreadable. Much of the programming I've done so far has been geared towards making the data more organized. Now, I'd like to get into more analysis.
The data is arranged by employee number (NOT in order, though). Each employee takes several calls over the course of the week, some for which the customer takes a survey. It's the survey scores I want. I want to take the average of all the surveys for each employee and then display that average in the same row as each of the entries.
Example
The yellow highlighted area is what I want to add. Any ideas? Thanks for any help in advance!
No need for VBA. If you have the supported version of Excel you can use AVERAGEIF. If not you can use below formula.
Enter as an array formula by pressing Ctrl+Shift+Enter when exiting cell edit mode (instead of just enter).
=AVERAGE(IF($A$2:$A$13=A2,$B$2:$B$13))
Then copy down for all rows.

Calculate "cell/sum(cells)" script across hundreds of small sets

I'm new here, and would greatly appreciate some help with this problem. I'm trying to take a column (Column H in this case) that's split up by blank rows into a few hundred sets of 21 cells each and find the portion of each cell to that set.
Picture - Objective: Take a cell and divide it against 21 other cells in that set. Skip the blank row and repeat the same process several hundred times.
For example, I want to find out: "In 2015, what portion of Alabama employees were in Management Occupations?" and come to the conclusion that 3.669% were in management (Solution example would be cell [I3]). I want to calculate that for all states across all occupations across all years.
I am currently doing this by typing out what's found in column K to get the solutions found in column I, but that is very laborious and seems inefficient. How would I go about getting solutions found in Column I in the easiest way possible?
Please note that the groups must be broken up by state, which is why there are blank rows between each state.
Thank you very much, and if you need a further explanation of what I'm trying to accomplish, please let me know and I'll respond immediately!
Use SUMIF():
=H3/SUMIF(C:C,C3,H:H)
It will now group the it by the state.
If you want to group it further then use SUMIFS():
=H3/SUMIFS(H:H,C:C,C3,A:A,2015)
This will group it by the state and year 2015.

Resources