displaying the count for of each column value in a dataset - excel-formula

I want to display the count of the first column, the following is a data set
Where the first column is the occurrence of year in the entire table.
Can anyone suggest the formula. I have used count(A) but its giving 1 everywhere

=COUNTIF($B$1:$B$8,B1)
This will assess the count based on a criteria. Notice the absolute referencing so that the count range does not update but the criteria does...

Related

Count unique values in a column with blanks for each row in excel

I have a column of data (shown below) that I want to count each unique value in this list. I used this formula:
SUMPRODUCT((B2:B11540<>"")/COUNTIF(B2:B11540,B2:B11540&""))
However it gives me the entire count of unique ids and I want to count per row. Also, since this column has lot's of blank fields I am not able to count for each row using CountIf. Ideally the blank rows should give 0 and other duplicates should be counted as 1. Does anyone has a way of solving this?
A-2019-000084
A-2019-000141
A-2019-002944
A-2019-000222
A-2019-000222
A-2019-000222
A-2019-000222
A-2019-004606
A-2019-004606
A-2019-000923
A-2019-000699
use COUNTIF with a variable range:
=--AND(A1<>"",COUNTIF($A$1:A1,A1)=1)
For a total unique non-blank count of your sample data in column A use,
=SUMPRODUCT((A2:A23<>"")/(COUNTIFS(A2:A23,A2:A23,A2:A23,"<>")+NOT(SIGN(LEN(A2:A23)))))
For a row-by-row count, (with the first A-2019-000084 in A2) use this in B2 and drag down.
=--(COUNTIFS(A$2:A2, A2, A$2:A2,"<>")=1)

Excel:In a table with two columns (item,quantity) finding out the name of the item with the largest quantity

I'm new to excel and I came across this problem.
I have a table with 2 columns one with the name of the item(the same name can appear multiple times) and next to it the quantity of said item.
What I want to get is the item which has the most overll quantity (keeping in mind that the object can appear multiple times in the table and have different quantities in each of the apppearences).
You didn't specify how you want to highlight the value.
Assuming your items are in column A and your values in column B.
Add a helper formula in column C to sum all the items.
=SUMIF($A$1:$A$100,A1,$B$1:$B$100)
you can use conditional formatting to highlight the highest value by adding a rule that uses a formula and entering;
=B1=MAX($C$1:$C$100)
It highlights every entry of the item with the greatest value.
To return the name of the item with the highest value you can use;
=INDEX(A1:A100,MATCH(MAX(C1:C100),C1:C100,0),1)
There are 2 parts to this formula
=INDEX(A1:A100,MATCH(MAX(C1:C100),C1:C100,0),1)
The match part finds the row number of the highest value and the Index part returns the value in column A for that row.
This solution may not be ideal if you have a huge amount of data so you could also try a pivot table and sort it highest to lowest.

How do I sum all entries that match a lookup table?

So I have a column of numbers I want to sum. Each number is associated with a value on a lookup table. I need to find what values I want to use to sum based on the lookup table itself.
Basically, I need to sum everything in column I based on whether the entry in column J matches a MFG in column M that matches a reference number in column O. I have tried multiple iterations of SumProduct and array formulas, and have had no luck getting it to work. Everything I've read online about summing based on multiple criteria only works if you know ahead of time how many conditions you have to match; I don't have that information.
This will iterated through the second table and if the Ref Num match the input in M16 then it returns the SUMIF() value of MFG from the first table and sums them all together:
=SUMPRODUCT((M16=$O$7:$O$12)*SUMIF(J:J,$M$7:$M$12,I:I))
Notice that the references to Table 2 are limited to the actual data, while the references to table 1 can be full column references. That has to do with how the formula will iterate. As it literally will iterate through the second table we want to limit the number of iterations to the data set itself. While the SUMIF() formula is already optimized and has no detriment to full column references.

Get Average from range with criteria

I have an excel sheet with 6 columns. The first column has the customer name, the 5th column has a number that I want to get an average of for all occurrences of a specific customer name.
I have tried the AverageIf function, but I am not understanding what to use for the criteria since it itself is a range to find the customer names in column 1. Any ideas?
In the syntax for AVERAGEIF, the first range is the names, the second value is a cell where you put the specific customer name (could just be a quoted string), and the third value is the range of values to be averaged, so:
=AVERAGEIF(A1:A7,I20,E1:E7)

Excel: How to find the first row's value of a column depending on where to find a given number in another row of the same column

Imagine a 100x100 table. I have to find a given value in the first column. Then I have to check the row contains that given value, and I have to find the column where the value is 1 (every row has only one cell with value 1), and I need the first row's value of that column. I've tried several lookup functions (vlookup, hlookup, index match match, etc). No results. Is it possible using only functions and no VBA at all?
I'd prefer to use INDEX rather than INDIRECT, it's not volatile and it's more robust in dealing with added rows or columns than "hardcoded" values like "B" and "D", so assuming data in A1:Z100 you can use this formula for the match, assuming a search value of "x"
=MATCH(1,INDEX(B2:Z100,MATCH("x",A2:A100,0),0),0)
...and you can add an extra INDEX function to retrieve the first row value for that column
=INDEX(B1:Z1,MATCH(1,INDEX(B2:Z100,MATCH("x",A2:A100,0),0),0))

Resources