lookup count on different tab using 2 variables - count

I have data on one excel sheet where there are about 10 columns But I need to count data using just two of them. For Example:
Column C has district names and Column D says what their title is.
The file has hundreds of entries and I need to know how many Admins are in district 1. Only that the results would be on a different tab. I have tried using Vlookup but my knowledge only takes me as far as looking up just one criteria.

If your "one excel sheet" is called Sheet1, district 1 is in ColumnC of that sheet and Admins in ColumnD of that sheet then on a different tab:
=COUNTIFS(Sheet1!C:C,"district 1",Sheet1!D:D,"Admins")

Related

Google Sheets- Split Cell w/ Data and Organize?

Hello Sheets Experts,
I'm looking to analzye some time data that I received in a Google Sheet. Unfortunately, the original data is in a less than friendly format.
Sample Sheet w/ Data:
https://docs.google.com/spreadsheets/d/1-eyyVs67pp4nyL7jboWmOkGnrkNuuwiPP2RVv_SuDz0/edit?usp=sharing
Ideally, I would like to take this "source data" (around 1500 separate cells)
Source Data
and pull the time listed for the last 4 days (indicated in my headers) and organize into separate cells for further analysis (like shown below, which I did manually):
Ideal Result
The tough thing is that each cell is unique as it contains a variety in both the quantity and calendar date.
Is there a way to break down the data in the column A to achieve my desired result?
I tried splitting the text to columns, which I can do 1 by 1- but am hoping there is a "smarter" way to do this with 1500 rows of data
split column
Ablebits powertools seems like it may help, but I don't have a subscription and am looking for a "free" way to do this via a formula.
Added solution to your sheet here:
=makearray(rows(A2:A),4,lambda(r,c,ifna(regexextract(index(A2:A,r),index(to_text(B1:E1),,c)&" \| (.*?)"&CHAR(10)))))
You can try with this formula:
=INDEX(VLOOKUP(B1:E1,INDEX(IFERROR((SPLIT(FLATTEN(SPLIT(A2:A13,CHAR(10)))," | ")))),2,0)&" min.")
It splits the values by the line separator (CHAR(10)), makes it a column with FLATTEN, splits again by "|" and FLATTEN; and then do a VLOOKUP with the headers
To the full range you can use:
=BYROW(A2:A,LAMBDA(a,IF(a="",{"","","",""},INDEX(IFNA(VLOOKUP(B1:E1,INDEX(IFERROR((SPLIT(FLATTEN(SPLIT(a,CHAR(10)))," | ")))),2,0)&" min.")))))

Uploading xls data with multi row column names in R

I've got a series of excel files to upload to R for analysis. I'm not sure how to shape/upload the data so that the column names come from the first two rows instead of just one row. When uploaded with row 1 as the column names "Health Outcomes" and "Health Factors" don't include column E and G so I cant just combine row 2 with the column names after the upload. I've tried other methods such as those here but they haven't worked since some of the entries in row 1 are blank. In theory I could make some of these changes manually but I'm sure there's a better way. Any help is appreciated!

Paste name of column to other columns in R?

I have recently received an output from the online survey (ESRI Survey123), storing the each recored attribte as a new column of teh table. The survey reports characteristics of single trees located on study site: e.g. beech1, beech2, etc. For each beech, several attributes are recorded such as height, shape, etc.
This is how the output table looks like in Excel. ID simply represent the site number:
Now I wonder, how can I read those data into R to make sure that columns 1:3 belong to beech1, columns 4:6 represent beech2, etc.? I am looking for something that would paste the beech1 into names of the following columns: beech1.height, beech1.shape. But I am not sure how to do it?

Merging multiple excel sheets based on different column values in R

I'm a bit new to R so apologies up front if its not explained as clear as it should be. I have 6 excel sheets within a single workbook (Trees_2020, Trees_2017, Trees_2014, Trees_2011, Trees_2008, Trees_2003). These contain plot IDs (ID_Plot), within plot tree ID numbers (ID_tree) and then growth data (DBH_mm). The problem is the tree IDs do not remain the same through the years but are linked based on their old ID (Field_Mapping software recognises them based on location but assigns a new number which is linked to the Old_ID).
What I'm trying to do is merge all the sheets linking the years together based on the plot ID and then the Old_ID to current ID.
2020 Data Example
2017 Data Example
You can see in the 2020 sheet a column linking to the Old_ID number of 2017 and this is true of all sheets. Trees that are recorded for the first time do not have an Old_ID number in that first recording.
The ideal output would be a single sheet where a unique identifier is added for each tree, the DBH of each tree for each year linked together based on the plot_ID and the within plot ID_tree (coupled based on Old_ID)
Ideal Output
Apologies if thats very confusing but I struggled to explain it in a simpler way. I've been playing with tidyverse and loops but can't seem to figure it out so any help greatly appreciated!

Count the number of blank cells below a non-blank cell

I am working in Microsoft Excel 2013. In the screenshot below, I have a list of people's names (under SURNAME column) and the household they belong to (New No.). I would like Excel to count the number of people in each household, and enter it into the HH Siz column. One person, Ntuyu, lives in WC335. Two people, N. Dlakiya and Y. Dlakiya, live in WC415. I need a formula to do this automatically. Please help. Thanks.
Screenshot of the excel sheet
Put this in C2 and copy down the list:
=IF(A2<>"",COUNTA($B2:B$1048576)-SUM(C3:C$1048576),"")

Resources