Count number of rows in column A that have a value in a list in column B on worksheet 2 - excel

I have a list of 3 digit phone codes in EST timezone in column A Sheet 2. I have in Column A Sheet 1 another list of 3 digit phone codes from people that have called in.
What I am trying to do is in Sheet 1 "B2" count the number of inbound calls (Column A Sheet 1) that exist in the EST timezone list (Column A Sheet 2).
I cannot seem to find a way to complete this using either formulas or macros.

You'll want something like this:
=COUNTIF(A:A,'Sheet2'!A##)
Just replace A## with the location of the 3 digit code from sheet 2 that you want to count.
EDIT:
Here is the code which solves your question. It counts the number of times any value within Sheet2!A:A is iterated in Sheet1!A:A
=SUM(COUNTIF(Sheet1!A:A,Sheet2!A:A))

Related

Excel formula for multiple conditions and worksheets

The aim
I am try to create a formula which will allow specific information from 90 different worksheets, with an example of one such worksheet being below. Each work sheet represents data from a participant.
I want the data from the 90 work sheets to be summarised into the worksheet below.
The problem
The problem is that I need to create a formula that takes counterbalancing into account.
So in cell A3 of the second image I would to record the number of times the value 1 and 3 appears in column I of the first image.
The conditions
However, I would only like the numbers in column I to count if:
a) in column M of image 1 there is a value of 1
and
b) when the number in Column L is 1 and Column K is 1 or 4 OR when the number in Column L is 2 and the number in Column K is 3 or 4.
My attempt
=SUM('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$M$2,1*(IF('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$L$2,1*(IF('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$K$2:$K$41,1,4*(IF('[All_memories_301-389_improved.xlsx]Sirma 301:387Yanxin'!$I$2:$I$54,1,3)))))))
This did not work however and I have spent a long time on this and made changes but I still can't seem to get it to work.
Extra information:
In column I I want to count all the occurrences of 1 and 3 provided the specified conditions are met. The rows are not important, but rather, the column I information for each of the 90 spreadsheets.
New attempt with formula:
=COUNTIFS('[All_memories_301-389_improved.xlsx]381Christie'!$M$2, 1, '[All_memories_301-389_improved.xlsx]381Christie'!$L$2, 1, '[All_memories_301-389_improved.xlsx]381Christie'!$K$2:$K$23, AND(1,4), '[All_memories_301-389_improved.xlsx]381Christie'!$I$2:$I$23, AND(1,3))

How can I remove non-matching values in two different columns and sort in Excel?

I have several columns of data in my Excel spreadsheet.
Originally, I had two different spreadsheets, as they were generated from reports in a software application.
One of the spreadsheets contains the names of individuals who have had transactions with us in the past year. The other spreadsheet contains the names and the phone numbers. I copied and pasted the columns with the names and phone numbers into my spreadsheet with just the names of people who have purchased something from us in the past year.
My ultimate goal is to extract the names and phone numbers of only the names that have purchased something in the past year.
My column for the past year contains 1,002 names, while my master customer list (with phone numbers) contains over 20,000 individuals. I need the phone numbers of all of the individuals that have purchased something from us in the past year, but I don't want to have to manually go through 1,000 names (and, essentially, 20,000+ to find the match).
If I can achieve my goal without having to use VBA, that would be great. If this is the only route I can take, then I will go that route, but I would like to avoid coding if possible. (This is simply due to time constraints.)
The VLOOKUP function is likely the best solution for you. From the Excel documentation, it:
Looks for a value in the leftmost column of a table, and then returns
a value in the same row from a column you specify. By default, the
table must be sorted in an ascending order.
Note well the implication of that last sentence: the column you're searching in (leftmost column of the lookup table) must be sorted in ascending order for this function to produce the correct results.
Taking a simple example, let's say you have Sheet1 in your Excel workbook with the following information:
A B C
1 Name Transactions Phone
2 Sally 3
3 Alice 5
4 Joe 2
5 Jon 1
You need to add their phone numbers to this sheet, from another workbook. Let's say your phone number information in the other workbook looks like this:
A B
1 Name Phone
2 Alice 2222222
3 Bill 3333333
4 Bob 4444444
5 Jim 5555555
6 Joe 6666666
7 Sally 7777777
8 Sue 8888888
9 Tom 9999999
Take the following steps to add the phone numbers to Sheet1 in the first workbook:
Copy the phone information into a blank sheet in the first workbook. Let's call this Sheet2 for this example.
Make sure the phone information is sorted ascending by the Name column (A), because that's the leftmost column and thus the lookup column.
In cell C2 of Sheet1 (the empty phone cell for Sally), enter: =VLOOKUP(A2, Sheet2!A$2:B$9, 2,FALSE).
Drag-copy this formula down to the remaining cells in the Phone column.
Result:
A B C
1 Name Transactions Phone
2 Sally 3 7777777
3 Alice 5 2222222
4 Joe 2 6666666
5 Jon 1 #N/A
Notes:
The second parameter (Table_array - the lookup data range) should not include the column headings. As you can see, it's Sheet2!A$2:B$9 so it includes the information from rows 2 to 9 in columns A and B.
The last parameter (Range_lookup) should be set to FALSE so you don't pick up the information from the closest match. Note how Jon has no matching phone number record, so his Phone is set to "#N/A" - otherwise he would have been assigned Joe's phone number since that's closest match to Jon.
Parameter documentation:
Lookup_value is the value to be found in the first column of the table, and can be a value, a reference, or a text string.
Table_array is a table of text, numbers, or logical values, in which data is retrieved. Table_array can be a reference to a range or
a range name.
Col_index_num is the column number in Table_array from which the matching value should be returned. The first column of values in
the table is column 1.
Range_lookup is a logical value: to find the closest match in the first column (sorted in ascending order) = TRUE or omitted; find
an exact match = FALSE.

Countif formula with multiple criteria

In my workbook, I have a 4 spreadsheets - Data, Amy, Betty, Connie. Data has the following columns:
Column A Column B Column C Column D
Row 3 Employee Total tasks last 30 days. Total tasks last 7 days. Date/Time Last task Assigned
Row 4 Amy
Row 5 Betty
Row 6 Connie
In A1 - worker with oldest task Date/Time Assigned. Cell B1 contains the answer to cell A1 by providing the employees name.
I enter the data in the individual workers spreadsheets (Amy, Betty, Connie) and my Data worksheet provides the summary. On my data worksheet, I have formulas that count the number of tasks within the last 7 days and last 30 days by using the date/time assigned column (Column E)in the individual worksheets. Currently, if someone is out of the office, on their individual worksheet, I enter OUT in the task column (Column B) and the date/time that they will return in the date/time assigned column (Column E)so it will skip them for B1 on my Data worksheet. I need a formula that would not count the date/time assigned if they were OUT as a task, when calculating in columns B and C in the data worksheet.
Here is the formula that I have currently for Column B (total tasks last 30 days)
{=COUNTIF(INDIRECT("'"&A4&"'!"&"E1:E1000"),">="&(NOW()-30))}
The formula that I have for cell B1 is:
{=INDEX(A4:A14,MATCH(MIN(E4:E14),E4:E14,0))}
Any help would greatly be appreciated.
I figured it out:
=COUNTIFS(Amy!E2:E1000,">="&(NOW()-30),Amy!A2:A1000,"<>out")
Like suggested in the comments, the COUNTIFS formula is what you want to use. Information about its usage can be found here.
Adding the condition for excluding the "OUT" values would make the formula look like this:
=COUNTIFS(INDIRECT(""&A4&"!"&"E1:E1000"),">="&(NOW()-30),INDIRECT(""&A4&"!"&"B1:B1000"),"<>OUT")

Finding matching value in sheet 2 and copy adjacent cells value in sheet 1

I have searched through many similar topics but could find nothing that will do what I need.
I am trying to create a worksheet that will track scores for a darts game.
On Sheet 1 I have two columns that simply tracks each players throws from 501 down to 0
Row 25 is the amount remaining for each player.
In Sheet 2 I have 2 columns. The Column A contains scores that you can check out on, and Column B contains the checkout e.g. (T20, T20, D18). So if the value in row 25 of Sheet 1 matches any of the values in Column A of sheet 2, the I want to display the Value of Column B in the matching row on Sheet 2 Underneath the remaining score on Sheet 1.
Can anyone point me in the right direction?
not sure what you mean exactly, but this formula in row 26 should do the trick:
=index('Sheet 2'!$B:$B;match(A25;'Sheet 2'!$A:$A;0))
if your list separator is comma ,, use that instead of semicolon ;
you might want to use 1 as the third argument of match function, if you want to display the checkout according to the nearest match that is bigger than the number in row 25 and the column A in Sheet 2 is sorted in ascending order (1-9)
or -1 if you want the nearest match that is smaller and column A is sorted in descending order (9-1)
You can use this:
=IFERROR(VLOOKUP(A4, Sheet2!$C$2:$E$65535, 3, FALSE),0)

Excel lookup vector based on another formula

My spreadsheet has 2 sheets.
Sheet 1 contains 30 days worth of values.
Each day's values are a maximum of 19 rows, consisting of names and correspoding values. The names that will appear for each day are not the same every day. In other words my name might appear on the 1st, 2nd and 14th of the month and not on any other days. (And these values may not be sorted.)
My second sheet will display only one persons values for the month, and I therefore use a lookup.
The formula for the 1st day is:
=LOOKUP("name";'Input Sheet'!$A$2:$A$20; 'Input Sheet'!B2:B20)
For the second day it would be:
=LOOKUP("name";'Input Sheet'!$A$22:$A$40; 'Input Sheet'!B22:B40)
The only thing that changes for each day is the lookup range/vector. I have a separate (hidden) column already that has calculated the correct starting row number, i.e. 22, 42, 62, but how would I use that number to change the lookup range on my formula?
Thanks a lot
Michael
The indirect() function will allow you to specify the range for your lookup in terms of another cell.
For example, if Sheet1 of the workbook has the numbers 1-10 going from A3:A12, where the starting row (3) is specified in cell B1 of the same worksheet.
3
1
2
3
4
5
6
7
8
9
10
Then to lookup the value 5 and place the answer on any other sheet of the workbook:
=LOOKUP(5,INDIRECT("Sheet1!$A"&Sheet1!$B$1&":$A$12"))

Resources