Count number of rows in which value occurs in any column - excel

Sample Data:
Desired result:
Name Number Handled
Bill 1
Erica 1
James 2
Jimmy 1
John 1
Kory 1
Setup:
Column W is "Incident Number", Column X is "Created by", Column Y is "Resolved By", and Column Z is "Updated By". The same person can create, resolve and update or can be multiple people. The boss is asking for each person in the team, how many tickets are they touching each day. So if "James" is opened, resolved, and updated ticket 22, he did one ticket. If James opened ticket 22 but Tony resolved it, they each touched ticket 22 so both get credit. Same with Updated. Could be same person, or 3 different. For each tech I need a formula to find the total number of tickets they touched, regardless of how many actions they did on the ticket.

Add another column (I used AA) that concatenates the three columns. You'll need to replace "Sheet1" with whatever the sheet name is
=CONCATENATE(",",Sheet1!X1,",",Sheet1!Y1,",",Sheet1!Z1,",")
Then your formula is a simple countif with search
=COUNTIF(AA:AA,"*,"&A2&",*")

You can use either of the following formulas to get the result (assuming your names are in column A of another sheet. Use the first formula if calculation speed isn't an issue and your number of rows varies a lot. Use the second formula for faster calculation if you can be confident that the number of rows won't go above some number. Just replace 1000 with your own number.
=SUMPRODUCT(SIGN((Sheet1!$X:$X=$A2)+(Sheet1!$Y:$Y=$A2)+(Sheet1!$Z:$Z=$A2)))
=SUMPRODUCT(SIGN((Sheet1!$X$2:$X$1000=$A2)+(Sheet1!$Y$2:$Y$1000=$A2)+(Sheet1!$Z$2:$Z$1000=$A2)))

Related

vlookup values from other sheets disappear when file closed

I've got a group of registers that I created for our volunteers and youth club members. Each register spreadsheet is from Sept to July. More and more volunteers and young people are staying with us for longer so I have been trying to create a vlookup that takes the total hours they volunteered from the previous years and add it to the current year total. This chains about 3-4 previous years of registers together. ie, 2014-15 adds to 2015-16 total, 2015-16 adds to 2016-17 total, 2016-17 adds to 2017-18 total, etc. The vlookup works great when all the previous years registers are open, but once I close one I get a #n/a error. How can I prevent the error msg and keep my formula working without opening all the documents?
Have you tried to specify the complete workbook path in your vlookup formula?
I.e. something like this:
=VLOOKUP(B1,'C:\School Projects\University\[Assignment.xlsx]DataYear'!$A3:$D10,3,FALSE)
Where:
Assignment.xlsx - is the name of workbook
DataYear - is the name of the worksheet
EDIT:
Since you mention you have tables when you are using your VLOOKUP you should use the Index + Match, is way more flexible. [#Data] won't work and VLOOKUP works best only if the return column is next to the search column, i.e. Column 1 is search and Column 2 is return values.
Example of applying INDEX + MATCH in table:
If I have an table in Book2.xlsx
And my table is named table 15:
Let's assume I have another woorkbook (Book1.xlsx). I want to check how many Quantity the person Sally sold. (My formula should return: 2, Cell C3).
Then my formula should be in the other excel book (Book1.xlsx):
=INDEX('G:\Folder Stuff\Book2.xlsx'!Table15[Qty],MATCH(B2,'G:\Folder Stuff\Book2.xlsx'!Table15[People],0))
So to apply for tables you should use:
Table15[Qty] - Return quantity, which refer to my column Qty in my example
Table15[People] - column to lookup my search value (sally), which refer to my column People in my example
Logic of INDEX + MATCH:
=INDEX(Column where result should be return,MATCH(lookup_value, Column where lookup value exist, Exact or Approximate Match)
So your formula should be something like this:
=INDEX('C:\Users\COG Youth Services\Dropbox...\Registers\Volunteers attendance record 2017-18.xlsx'!Table14[Name of the table column in Column 37],MATCH(StudentLookup,'C:\Users\COG Youth Services\Dropbox...\Registers\Volunteers attendance record 2017-18.xlsx'!Table14[Name of the table Column where StudentLookup exist],0))

How to search and combine several sheets in Excel?

I am trying to do an Excel sheet to do some statistics about athletes in world cup competitions.
I have a worksheet on excel for every competition, plus one for the overall result after the season (which thus has a list of every athlete that competed at least once).
The worksheets have the name of the location where the competition happened. Eg: PARIS.
I have one more sheet, named "Athletes". what I want to do there is:
for every athlete appearing in the "overall" list, I want the columns after the name to be filled with the results in every location the athlete completed in.
For example
Name Paris London LA Berlin
Amoros 1 5 / 7
Bilboni 2 43 3 12
To find "1", I want excel to search the sheet "Paris" for "Amoros" and extract the ranking in the row it finds "Amoros".
Let's say it finds "Amoros" in cell L57, then the corresponding ranking to extract will be in K57. "/" indicates Amoros didn't compete in LA.
I am using Excel 2016 on a Mac.
Thanks a lot in advance!
Ben
If you data is set up starting in A1 you would use INDEX/MATCH with INDIRECT to set the sheet:
=IFERROR(INDEX(INDIRECT("'" & B$1 & "'!$K:$K"),MATCH($A1,INDIRECT("'" & B$1 & "'!$L:$L"),0)),"/")
This formula would go in B2 and be copied over and down the dataset.

Count occurrences of certain number in worksheet column, looking up by header row

We keep track of salaries using an excel file with a tab per month:
50 = regular salary
100 = regular salary for double shift
30, 60 etc. are exceptions that don´t need to be considered
Now my boss wants to know who worked how often considering the normal and double shifts only. so the result should be a list(table) like Bob 50*X, 100*Y, Bill 50*X, 100*Y
What would the syntax look like? It´s possible that while Bill is B1 in January it might be that he is C1.. in another month so the solution should use the header row to do a lookup.
In your example, the formula
=COUNTIF(B2:B7,50)
will return the number of instances of the data 50 in the range B2:B7.
In order to find the column corresponding to a specific employee you can use MATCH, (e.g.) MATCH("Bob",B1:C1,0) which finds the exact text Bob in the range B1:C1. Now you need to change the range in your COUNTIF function to correspond to the column for Bob, which you can do with OFFSET:
=COUNTIF(OFFSET($A$2,0,MATCH("Bob",$B$1:$C$1,0),6,1),50)
The number 6 in the above formula is the number of rows containing salary data - could that change? If so you could replace it with e.g. MATCH("Tot",$B2:$A99,0)-1 which will count how many rows there are from row B to the row containing Tot.
Look up the functions COUNTIF, MATCH and OFFSET in the Excel help for more detail on how to use them.

Excel: How to find the last empty Cell

In Excel, does anyone know how to look Upward from a given row to find the last blank Cell?
I've got a strangely formatted excel export that I'm trying to report out of. However, i'm stuck trying to find an efficient formula to find the data.
Here are 2 examples of the exported format of this report. For each "Item Number" it's listing all the parts it's used in. This might be just one SKU, or 15 SKUs, or none. So this causes sub-header area to not be a consistent size. Each new Item number gets this same format. I've got 8000+ Item numbers, each output this same format.
here is the array formula:
{=INDEX($B$1:$B$70600,SMALL(IF("Item Number:"=$A$1:$A$70600,ROW($A$1:$A$70600)-ROW($A$1)+1),COUNTIF(INDIRECT("$A1:$A"&ROW()),"Item Number:")))}
My formula basically looks for the SKU (i.e. 35376) and reports back the above Item number it uses (i.e. 02859). It does this by finding the row number of the SKU, and then counting the number of strings "Item number:" from the top to current row, and reports the last one.
**
Created By: Employee
Create Time: 01/08/2015 04:16:16 PM CST
Where Used Report
Item Number: 02859
Description: Packaging 35376
Level Subclass Number Rev Description Find Num Qty BOM Notes
.. 2 SKU 45268 A        MCO-01101 Product Name  0 1
Created By: Employee
Create Time: 01/08/2015 04:16:16 PM CST
Where Used Report
Item Number: 02858
Description: Packaging 35345
Level Subclass Number Rev Description Find Num Qty BOM Notes
.. 2 SKU 35376 E        ECO-07812 Product name 0 1
.. 2 SKU 39022 A        MCO-01198 Product Name  0 1
.. 2 SKU 39033 A        MCO-01187 Product Name 0 1
**
However, my current function is crashing out as i've got 70k rows it's searching through.
What I'd rather do, is simply look UPWARDS in the sheet to find the row number of the last header value (i.e. "Number") or even just the last empty cell. Instead, it seems that most of the functions are geared around looking down to the next value. Which forces me to look from the Top to the current row.
Anyone know how to look Up from a given row to find the last blank Cell?
You can use LOOKUP in various ways to get the last occurrence of some value, e.g. this formula in row 100 will find the last instance of "Item Number:" in column A above and return the corresponding value from column B
=LOOKUP(2,1/(A$1:A99="Item Number:"),B$1:B99)
This can be fast if you know how many rows you need to look at, e.g. if the previous "Item number" will always be within 30 rows you can set the range in the formula to look at only 30 rows
It's possible using SUMPRODUCT, but s it searches all 10xxxxx cells in a column, don't have too many, else the spreadsheet will slow to a crawl.
=INDEX(B:B,SUMPRODUCT(MAX((A:A="Item Number:")*ROW(A:A))))
This will return the data in column B where the last "Item Number:" appears

Nested If statement Excel - checking if value exists

I have a spreadsheet with multiple row with varying data in the collumns eg:
Student NO Book1 Book 2 Book 3 Book 4 Book 5
X 12
Y 13 12 23 23 32
What I want to do is a Lookup of that mark in another table to see if the book exists, and to come back with NA if the mark isn't in the other spreadsheet.
I have the following code, although if the book isn't in the bounds then it comes back as blank. :'( is there a way to make it N/A.
=IF(ISNA(VLOOKUP(Q3,'Libary Books 21-06-13'!$A:$B,2,FALSE)),"",VLOOKUP(Q3,'Libary Books 21-06-13'!$A:$B,2,FALSE))
Many thanks
Just replace "" in the Value_if_true part of your formula with "NA".
=IF(ISNA(VLOOKUP(Q3,'Libary Books 21-06-13'!$A:$B,2,FALSE)),"NA",VLOOKUP(Q3,'Libary Books 21-06-13'!$A:$B,2,FALSE))
EDIT BASED ON COMMENT:
The best way to understand these kinds of nested formulas is to make them as simple as possible so that you can make sure what is happening.
I set up two columns, Book Name in column A and Nested If in column B on a single sheet.
The formula in column B is
=IF(ISNA(A2), "", IF(A2="", "Doesn't Exist", A2))
I copied and pasted that formula to all rows. Here are the results:
Book Name Nested If
The Sun Also Rises The Sun Also Rises
Doesn't Exist
#N/A
You can use the formula above as your template.

Resources