COUNTIF and VLOOKUP

I have a worksheet named CODES with 41 codes in column A and either a 1 or 0 in column B that indicates if occurrences of each of the codes should counted. 1 means the code should be counted, 0 means that the code should not be counted. I have another worksheet
with column J of code occurrences. I need the total count of rows in column J having codes that should be counted. I thought I might be able to use =COUNTIF(J2:J101,"=VLOOKUP(J2:J101,'CODES'!A2:B42,1)") but that does not seem
to work. What is the right way to accomplish the task? 

The code in the cells can be translated to values by using VLOOKUP. So column A in rows 1 through 5 has code values:
code1, code2, code1, code3, code2, code1
The codes worksheet on row 1 has code1 in column A and the number 1 in column B. Row 2 has code2 in column A and 0 in column B. Row 3 has code3 in column A and the number 1 in column B. So the codes worksheet can translate any code to either a 1 or a 0.
At the bottom of column A on my data sheet I want to sum the translation of the codes found in the column - presumably using vlookup, and get the sum 4, because rows 1, 3, 4 and 5 have codes that get translated to the value 1.
Again - how can I upload a sample worksheet to make this clearer?

Similar Messages

  • Using COUNTIF formula using controlled data in cell pop-up menu

    I'm making a spread sheet that involves adding up the number of times a certain item occurs in a log. A pop-up menu is used in the cell to control the inputs of the log. I'm not sure how to go about using the COUNTIF function to count the number of times each item occurs. The "workout tracker" template in Numbers '09 does what I need to do when counting the "number of days exercised", but I don't understand how it was done. Can anyone explain this to me?
    My log table is: (Dashes denote spacing)
    Date---------Log Item-----Time
    01/03/09---Item 1-------9:00am
    02/03/09---Item 2-------12:15pm
    03/03/09---Item 3-------9:10am
    (you can only chose Item 1, 2 or 3 from a drop down list, you can't manually input anything else)
    I want to use a countif command for a table that is:
    -----------No. of Occurances
    Item 1-------1
    Item 2-------1
    Item 3-------1

    I'm guessing you are curious about the way they did COUNTIF and what "Indicator" is. If you unhide all columns in the Workouts table, you'll see a column D with the header "indicator". The reference to "Indicator" in the COUNTIF functions refers to the entire column. There is a fairly long formula in the cells of that column but, basically, it just populates it with 1-3 depending on what you pick in the Activity popup.

  • Two columns + countif

    Hi,
    I'm trying to get some data from one table into another and count the occurences of a text using countif and get the matching amount with it.
    and get the total of the amount based on all occurences
    example
    table 1
    name
    amount (dollar/euro)
    Jeff
    50
    Max
    100
    Jeff
    25
    Elisa
    40
    table 2
    Name
    No. Transactions
    Total (dollar/euro)
    Jeff
    2
    75
    Max
    1
    100
    Elisa
    1
    40
    So anyone suggestions on how to proceed?

    you can use countif() which will look at a range of cells (which you provide as the first argument) and checks with a condition which you include in the second argument.
    You can also use a realted function to add up the transactions for each person-- sumif().  SUMIF() takes three arguments, the range of cells to check, the condition and what to sum.
    below is my "rework" of your original tables using these formulas:
    The formula in Column B2 = =COUNTIF(Table 3 :: $A , "="&A2)
    copy this formula down the column by hovering the cursor over the bottom-left corner of the cell to expand, then click, hold, and drag down.
    Cell C2 = =SUMIF(Table 3 :: $A, "="&A2, Table 3 :: $B)

  • I need help creating a formula that looksup cell data and give a value.

    I want to have the table "At a glance"  show the total days a driver has worked, there total in sales and there total in milage. The table shown is a example of what I want to have happen. I want to input any name into cell B2,C2,D2,ect. that is found in the row C2:C17 of Checkpoint (Truck 1) and Checkpoint (Truck 2) and return the total amount of day the driver has driven both trucks, The total in sales the driver has collected (Truck 1 and 2) and How many miles the driver has driven (Truck 1 and 2). I realize that these tables are not labeled correct. If I enter a name into B2 and the driver associated with that name hasnt driven then I want "N/A' to show in cell B2 and so one. I assume that the formula that is created for cell B2 will be copied and pasted into cell C2, D2, ect..
    If someone could help me with this problem I'd really appreciate it.
    Thanks.

    Hi br,
    To show the number of days worked by a driver, you need to COUNT the number of times that driver's name appears in row 2 of both tables.
    To calculate his total sales and total mileage, you need to SUM the amounts he brought in each day and the distances he drove each day.
    Your functions for this are COUNTIF and SUMIF.
    Formulas in At a Glance:
    B2: =COUNTIF(Truck 1 :: $3:$3,B$1)+COUNTIF(Truck 2 :: 3:3,B$1)
    B3: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $5:$5)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $5:$5)
    B4: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $12:$12)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $12:$12)
    Fill all three formulas right to the last column of At a Glance.
    To put N/A in place of the 0 in Roger's column and the empty columns, wrap each of the formulas in an IF statement:
    Bn: =IF(AND(ISERROR(MATCH(B$1,Truck 1 :: $3:$3,0)),ISERROR(MATCH(B$1,Truck 2 :: $3:$3,0))),"N/A",formula)
    Where formula is the formula used in column B above.
    Regards,
    Barry

  • COUNTIF doesn't count cells that contain line_breaks

    I need help with the COUNTIF/COUNTIFS functions.
    If a cell that contains the target string also contains a LINE BREAK character, COUNTIF and COUNTIFS do not count it.
    I found that it works if I refer to a particular cell using the T and CLEAN functions in the formula
              =COUNTIF(T(CLEAN(cell),"target string"))
    but T and CLEAN don't work with ranges.
    Any help you can provide will be greatly appreciated.
    Thanks.
    George

    If there is a linefeed, the string doesn't match the condition so it's normal that it's not counted.
    One way to get rid of your odd entries is to insert a new column in which a formula will grab the contents of the original cells and clean them.
    This way you will be able to apply COUNTIF on the new column.
    In cells of column C the formula is :
    =CLEAN(B)
    In E2, the formula is :
    =COUNTIF(C,"target string")
    Of course, you may hide the column C
    Yvan KOENIG (VALLAURIS, France) vendredi 15 juillet 2011 11:02:29
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Need help with a calculated column - is there any way to reference a value in the current row?

    Hey guys,
    I'm a bit of a DAX newbie, and I'm running into a block. I'm creating a Power View report about IT tickets. We are going to be creating a cube to automate the data soon, I'm currently working with a flat Excel Data Table of data to demonstrate the Power
    View reporting capabilities to the team. I need the default display to show the top 4-5 items basked on the Ticket Count. The three applicable columns I'm using are the TicketID, the ContactReason, and the AssetCategory - all three are
    text. One slide will show the top five Contact Reasons by Ticket Count, and the other will show the top five Categories by Ticket Count. The users will see this default view, but will be able to change it to see differently ranked items or can clear the
    ranking slicer altogether.
    What I've accomplished so far is to create the Calculated Field [Ticket Count] = COUNTA(Table1[TicketID])
    And 2 other calculated fields:
    [Contact Rank] = RANKX(ALL(Table1[ContactReason]),[Ticket Count],,,DENSE)
    [Asset Rank] = RANKX(ALL(Table1[AssetCategory]),[Ticket Count],,,DENSE)
    If I were creating a Pivot Table, this would be great. These fields calculate everything the right way. The problem is, I need to have a Rank slicer on each slide and the calculation by itself contains no data - with no data, there's nothing to slice. I
    realized I need to actually have columns of data so I can create a slicer. I need each row of the table to show the same [Contact Rank] for every instance of a particular ContactReason (and the same for the [Asset Rank] and AssetCategory).
    The RANKX formulas pasted into the Calculated Column section only show a value of 1 - with no Pivot table summarizing the fields, it's counting each row's ticket once, giving every line the tied Rank of #1.
    I've solved the problem in Excel by creating 2 Pivot Tables on a separate sheet that have the data field and the calculated field for ContactRason and AssetCategory. Then on my Excel Data Table, I've added two columns that do a VLOOKUP and pull over a the
    Calculated Rank from each Pivot Table that match the ContactReason and AssetCategory fields. This works on the flat Excel Data Table now, but will not be a solutions when we start pulling the data from the cube (and there is no flat table).
    What I think I need is an Expression for the RANKX formula that can give me, for each row, the count of all of the times a ContactReason shows up in an entire column. There's only about 100,000 lines of data and each ContactReason or AssetCategory
    may show up several thousand times. But if I can get the expression to return that count, then the RANKX formula should work in the Column. If it wasn't a DAX formula, I'd use a COUNTIF and say 'Count the entire ContactReason column anytime it's equal to the
    ContactReason on THIS row', but in DAX I don't know how to reference a single value in a row. I've tried the CALCULATE() formula, but it seems like the filter needs a specific value, and doesn't work on a dynamic "cell" value.
    Any help would be greatly appreciated! (I hope it all makes sense!)

    If I've understood you correctly then the ALLEXCEPT function may be what you're after and it could be applied in a similar way to the following...
    =
    RANKX(
    ALL(Table1),
    CALCULATE(
    COUNTROWS(table1),
    ALLEXCEPT(Table1, Table1[ContactReason])
    DENSE
    If this has missed the mark, would it be possible to clarify the requirement further?
    Regards,
    Michael Amadi
    Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
    Website: http://www.nimblelearn.com
    Blog: http://www.nimblelearn.com/blog
    Twitter: @nimblelearn

  • Unsupported formula

    Hi all.
    I'm currently working on a Xcelsius project where I have included a fomula to extend  the VLOOKUP functionality. The formula makes VLOOKUP return all instances of the criteria given, from the range table.
    It looks like this:
    =IF(ISERROR(INDEX($A$1:$H$137;SMALL(IF($A$1:$A$137=$J$39;ROW($A$1:$A$137));ROW(1:1));2));"";INDEX($A$1:$H$137;SMALL(IF($A$1:$A$137=$J$39;ROW($A$1:$A$137));ROW(1:1));2))
    The formula looks in a range, returns the row number, then returns the value from the column specified. The formula works as expected in the Xcelsius spreadsheet, but when generating preview, Xcelsius says ROW formula is not supported - and the desired functionality does not appear in the preview.
    I have checked documentation for supported Excel formulas, and all formulas used is listed as supported.
    Any hints on how to handle this? Or how to make a workaround to achieve the same functionality?
    Thanks.
    Best regards,
    Runar Wigestrand.

    Hi,
    Excel supports formulas only for small data set's If you wanna show that on to the dashboard.However Xcelsius Support
    Sumif,Countif,Hlookup,Vlookup .But not the formulae what you had written.
    Please take out the SMALL from the formulea you have written.And try this..I will give you the error ,Till you remove the SMALL.
    Any concerns write to me.
    Thanks&Regards,
    satish.p

  • Spreadsheet Confusion

    Dear all,
    I'm not even sure if this is the right place to ask but I wonder if anyone can give me a steer?
    I need to make a spreadsheet that I can use for my child’s badminton scores.
    Essentially there are 5 players (A,B,C,D,E) playing doubles on one court.
    There are 15 permutations
    A+B vs C+D (E sits out)
    B+C vs D+E (A sits out)
    C+D vs E+A (B sits out)
    D+E vs A+B (C sits out)
    E+A vs B+C (D sits out)
    B+C vs A+D (E sits out)
    B+D vs C+E (A sits out)
    D+E vs A+C (B sits out)
    A+E vs B+D (C sits out)
    A+B vs C+E (D sits out)
    D+B vs C+A (E sits out)
    C+D vs B+E (A sits out)
    C+E vs A+D (B sits out)
    A+D vs B+E (C sits out)
    A+C vs B+E (D sits out)
    I have recorded the scores for each game over the last year.
    To win, a team must reach a score of 21 but be clear by 2 points so the winning amount can be higher if it’s a close game.
    I would like to create some kind graphical representations of the data but to my shame I have been stumped.
    I have tried to find something similar online but with little sucess.
    Any help greatly appreciated.
    Kind regards
    Chris

    I think this may be a good start:
    The table on the left is titled "Games" and is where you enter the players (columns A, B, E, and F), the scores (columns H and I).  Column C, G, and J may be hidden and are caluclation columns used in other tables.
    For the table Games:
    C2=IF(A2>B2, B2&A2, A2&B2)
    This is shorthand for in cell C2 type (or copy and paste from here) the formula:
    "=IF(A2>B2, B2&A2, A2&B2)" without the first and last double quotes
    select C2, copy
    select column C,  now hold the command key and click cell C1 (to unselect), paste
    select column C, copy
    select column F, paste
    J2=IF(OR(ISBLANK(H2),ISBLANK(I2)),"", "Team "&IF(H2>I2, "1", "2"))
    select J2, copy
    select column J,  now hold the command key and click cell J1 (to unselect), paste
    enter your games as needed in this table.
    Now create a table like show in the top, right called "Players".
    In the ID column (column A) enter the player ID (consistent with what was used in the "Games" table)
    In the Name column (column B) enter the player name
    C2=COUNTIFS(Games::A, A2, Games::J, "Team 1")+COUNTIFS(Games::B, A2, Games::J, "Team 1")+COUNTIFS(Games::E, A2, Games::J, "Team 2")+COUNTIFS(Games::F, A2, Games::J, "Team 2")
    D2=SUMIF(Games::A, A2, Games::H)+SUMIF(Games::B, A2, Games::H)+SUMIF(Games::E, A2, Games::I)+SUMIF(Games::F, A2, Games::I)
    select C2 and D2 and fill down
    Now create another table called "Teams" as shown in the bottom right. enter the player combinations as shown:
    B2=VLOOKUP(LEFT(A2, 1),Players::A:B, 2, 0)&" and "&VLOOKUP(RIGHT(A2, 1),Players::A:B, 2, 0)
    C2=COUNTIFS(Games::C, A2, Games::J, "Team 1")+COUNTIFS(Games::G, A2, Games::J, "Team 2")
    select B2 and C2 then fill down

  • Line item report with Customer number

    Hi all,
    I am facing the following issue:
    I need a line item report to analyze an accrual account by customer.
    Since the customer is not captured on the accrual account itself, but on the recon. account (which is not defined as line item display), I did not find a way to present the customer and the accrual  on the same line.
    I can always go to BSEG and vlookup and match by document number the accrual account and the customers from the customer recon. account, but I thought maybe someone has a better idea.
    Thanks,
    Yoel.

    If the recon account line items have al lthe info needed I'd suggest using a query (SQ01).
    1. Create an Infoset in SQ02 with logical database "BRM". Choose the fields from BSEG that you need
    2. Create the Query in SQ01 using that Infoset.
    If you want to see individual line items, include the fields you want in the "basic list" of the query. If you want totals by customer, don't include anything in the basic list, but make a "statistics" with customer and amount.
    Selections would habe to be made for account no and period.

  • Check for Duplicates

    Hi folks.  Any chance for some help with formulas on this one?
    I have a column of numbers.  I want to set a calculation in another test column, to see if there are any duplicates. 
    Column C:  The numbers to test
    Column J:  The test column
    So for J:
    =COUNTIF($C$2:C$48,"=C2")
    It's showing up 0 for the first item.  I enter the following and it works (C2 is "1065" as a number:
    =COUNTIF($C$2:C$48,"=1065")
    So I have to bring in the value of the C column into this formula and I'm good.  Why it isn't working now, I don't know.  I'm using the J column to report 1 as showing C column as unique, and anything > 1 as being a duplicate (at least). 
    Any advice? 
    Cheers

    Hi Rich,
    One of the trickiest things to grasp in using COUNTIF (and the other ...IF, ...IFS statements) is the specification that the condition must be specified 'as text'.
    Taking that literally, you've set the condition as "=C2"
    Unfortunately, this condition will count the number of times the sting "C2" appears in the range C2:C48. The correct answer to that, as the result shows is 0.
    Change your condition to "="&C2 and the formula will give you the correct count of the number of times the content of cell C2, as text, appears in the range. In fact, for a condition using the = operator, the operator may be eliminated.
    Here's an example, using both styles of the formula (listed below the image):
    Column D uses the 'standard' form of COUNTIF:
    D2, and filled down: =COUNTIF(B,"="&B2)
    Column C used the shortened form:
    C2 and filled down: =COUNTIF(B,B2)
    Regards,
    Barry

  • How can I display a specified row from a chart in a 2nd chart in Numbers?

    I have a chart in Numbers '09, which contains tasks with their due dates. This chart is rather large and is divided into several categories (i.e. home, work, taxes, etc.). Each row in the chart has a task name and due date in addition to other information in columns. Since it has many tasks and they are divided into categories, it's difficult to check what tasks are due this week. I have been trying to add a small chart to display only the task name and due date from all categories due in the next 10 days.
    I assume I should add a chart in the work sheet and use some string of functions to find tasks due this week, and copy them to the 2nd chart. If someone could suggest a string of functions, or tell me an easier way to do this I would be grateful.
    Jim

    Hi Jim,
    Welcome to Apple Discussions and the Numbers '09 forum.
    Using the correct vocabulary would make your request much easier to read. A "chart" in Numbers is a bar graph, a line graph, or a pie chart.
    What you're referring to as a "chart" is a "table."
    So:
    You have a table listing tasks and their due dates, plus other information (presumably all separate columns).
    You want a separate table listing only those tasks whose due date falls within the next ten days.
    Here are two ways to make those tasks stand out. The first uses conditional formatting to change the fill colour of the Date cells on the first table; the second uses an index and VLOOKUP to transfer the urgent tasks to a second table.
    The conditional formatting rules shown are applied to all cells in column A. Dates within 5 days of "today" (January 13, 2011 in the example) get a red fill and white type; dates within 10 days a yellow fill.
    The same rules, with effective periods reduced to 2 and 4 days, are applied to dates in the Urgent table below.
    Here a column is added to the left of what was column A to hold an index created by the formula below, entered into the new cell A2 and filled down to the bottom of that column. As noted in the header cell, this column may be hidden.
    =IFERROR(IF(DATEDIF(TODAY(),B,"D")<11,DATEDIF(TODAY(),B,"D")+ROW()/10000,66000), 66000)
    The formula provides a unique numerical value in each row where the date is less than 11 days from today, and a large fixed value in rows where the date is before today or more than 10 days away.
    On the second table, "Urgent" the formula below, entered in A2 and filled down the full column and right to column B transfers the dates and tasks due within ten days from the table "All tasks" in order of 'days to complete,' with the earliest ones at the top of the list.
    =IF(SMALL(All tasks :: $A,ROW()-1)<66000,VLOOKUP(SMALL(All tasks :: $A,ROW()-1),All tasks :: $A$2:$C$21,COLUMN()+1,FALSE),"")
    Descriptions of all the functions used, including examples, may be found in the iWork Formulas and Functions User Guide. Details on Conditional formatting may be found in the Numbers '09 User Guide. Both guides may be downloaded through the Help menu in Numbers '09. Both are recommended.
    Regards,
    Barry

  • Using formulas in combination with dates

    I'm a salesman and I track my daily sales on numbers. I have 5 columns: date, sales number, sales amount, then other stuff. I need a formula to track on the sales for a certain 2 weeks pay period for another table. I need one that sums the total $ amount of the sales and one that just counts the number of sales. Any help would be greatly appreciated.
    Thanks

    to get the count, I had to use the countif and the concatenate command together.
    If my compare date was in A1 and my information was in Table 2.. Column A was dates and B was Dollars.. modify to fit your final data, it would look like this:
    =countif(Table 2::A,concatenate(">=",A1))
    And the sum of the Column B in table 2 for the same condition would be:
    =Sumif(Table 2::A,concatenate(">=",A1),Table 2::B)
    Jason

  • Selecting a Number of Cells to Calculate

    I have a science project that involves taking large amounts of masses at specific dates then averaging these specific dates together. Is there any way to get a function to automatically select cells with a specific date/value/text in them?
    Thanks.

    Welshej wrote:
    I have a science project that involves taking large --amounts-- numbers of masses at specific dates then averaging these specific dates together. Is there any way to get a function to automatically select cells with a specific date/value/text in them?
    Do you want to calculate the average of the dates, or the average of the masses measured on those dates?
    Is there a pattern to the specific dates to be selected? Are measurements taken on other dates, and if so, are these measurements to be ignored?
    How are the dates specified? Is there a pattern (eg. every Monday, or the 15th of each month, or every third day, starting January 1, 2010), or would a list of the dates appear random (except that the list would be in ascending order)?
    Your easiest method of selecting the dates is likely to use one of the LOOKUP functions: HLOOKUP, p. 234, LOOKUP, p 245, or VLOOKUP, P. 288.
    Which is appropriate depends on how your data is arranged and whether an exact match to the date is needed. HLOOKUP and VLOOKUP allow specifying an exact match; LOOKUP does not.
    Once you've collected the values into a list, use AVERAGE (p. 211) to calculate the average (arithmetic mean) of the values. Note that although the User Guide doesn't say so in its article, the list of numbers can be specified as a range—AVERAGE(C2:C17) would return the average of the numbers in cells C2 through C17.
    Take a look at the description and examples in the Numbers User Guide supplied with your copy of iWork '08 (Page numbers are given above). You'll find this guide in the iWork '08 folder in your Applications folder. If it's not there, you can download it via the Numbers User Guide item in the help menu in Numbers.
    If you need additional help after reading those sections, post a reply in this topic with a more specific description of what you want to do and what help you need.
    Regards,
    Barry

  • Can I convert a PowerPivot database to Excel

    I used PowerPivot's import features to filter and reduce the number of fields in a very large database.  The database is now small enough to use in Excel without the aid of PowerPivot (I feel more comfortable using Excel and can take advantage of Excel
    features such as remove duplicates and vlookup).  Is there any way that I can covert the PowerPivot data to a regular Excel file?  For example save as Excel or export to text and then import to Excel?

    Kerry,
    My initial recommendation would be to try to use Powerpivot as particularly the two requirements can be realised quite well in there vlookup (relationships in PowerPivot and RELATED function) for duplicates use a distinct statement (DISTINCT
    clause to SELECT in SQL statement:
    SELECT DISTINCT
    …FIELDS…
    FROM
    … etc.)
    in the data source definition or this approach: http://www.powerpivotpro.com/2012/11/finding-duplicate-rows-in-powerpivotacross-tables-or-within-tables/ 
    If you really don't want to use PP: select the respective table in the Powerpivot dialog and click on the content top right hand corner and copy and paste into the workbook.
    Hope that helps!
    Martin Kratky
    www.managility.com.au

  • How do I count the number of times a particular year occurs in a range of dates?

    One column in my spreadsheet is a date and time.  I want to be able to count how many times a particular year occurs.
    Is there a way to combine the COUNTIFS and YEAR functions, or is there something easier to use?
    I'm using Numbers '09.
    Thank you for your assistance.

    You could use COUNTIFS with the two conditions being ">="&DATE(year, 1,1) and "<"&DATE(the next year, 1,1)

Maybe you are looking for

  • NetBeans 5.5. + layout - how can I make a jar?

    1. I try to build my application. 2. I've developed it in NetBeans 5.5 3. I ve used form as a base for my GUI 4. I've made application with help of GUIBuilder+some swing components I create dynamically during program execution. The problem: I can't m

  • PO with account assignment category F

    Hi Gurus, For PO with account assignment category F, the system is creating aaccounting documents during GRN for some POs & for some pOs it is not . What could be the reason. Regards, Kumar

  • 3000 n200 Optical Drive problems

    Hi all. I have a Lenovo 3000 N200  MT0687, that has NEVER had a properly working optical drive. Purchased this machine, was on display, and they had lost the box, and no one knew the password on it, so formatted and installec Win XP. The optical driv

  • Consignment and pipeline settlement error

    Hi Expert! I have error when processing consignment and pipeline settlement for company code 4424. The error is "No message was found for partner 146073/company code 4424". Can anyone tell me what has going wrong and how to solve it? Thanks.

  • Renaming Multiple photo titles in iPhoto

    I work for a photographer who recently purchased a iMac. He wants to use iPhoto for importing and editing but he uses different flash cards and when the photos are imported there are multiple pictures with the same file name (example: IMG_0001) Is th