Merge data from several columns in pivot - excel

I need to count how many times a given input data is found in four different columns and summarize that in a pivot table. There are other columns in the data table that I also want to be able to track in the pivot table. How can I easiest count the number of entries, such as pictured in the attached?
Columns MQ?
/E

Here are a number of ways to count cells in Excel:
Cell Counting Techniques
Excel provides many ways to count cells in a range that meet various
criteria:
The DCOUNT function. The data must be set up in a table, and a separate criterion range is required.
The COUNT function. Simply counts the number of cells in a range that contain a number.
The COUNTA function. Counts the number of non-empty cells in a range.
The COUNTBLANK function. Counts the number of empty cells in a range.
The COUNTIF function. Very flexible, but often not quite flexible enough.
An array formula. Useful when the other techniques won't work.
Formula Examples
Listed below are some formula examples that demonstrate various
counting techniques. These formula all use a range named data.
To count the number of cells that contain a negative number:
=COUNTIF(data,"<0")
To count the number of cells that contain the word "yes" (not case
sensitive):
=COUNTIF(data,"yes")
To count the number of cells that contain any text:
=COUNTIF(data,"*")
To count the number of cells that contain text that begins with the
letter "s" (not case-sensitive):
=COUNTIF(data,"s*")
To count the number of cells that contain the letter "s" (not
case-sensitive):
=COUNTIF(data,"*s*")
To count the number of cells that contain either "yes" or "no" (not
case-sensitive):
=COUNTIF(data,"yes")+COUNTIF(data,"no")
To count the number of three-letter words:
=COUNTIF(data,"???")
To count the number of cells that contain a value between 1 and 10:
=COUNTIF(data,">=1")-COUNTIF(data,">10")
To count the number of unique numeric values (ignores text entries):
=SUM(IF(FREQUENCY(data,data)>0,1,0))
To count the number of cells that contain an error value (this is an
array formula, entered with Ctrl+Shift+Enter):
=SUM(IF(ISERR(data),1,0))
Source: spreadsheetpage.com: Cell Counting Techniques

Related

How to calculate how many text cells are same in row before (or chosen row)

I am doing some excel staff, and now need an formula to calculate how many is same and mark them.
Example i have row with 10 cells and want to compare with row under how many same cells are.
I marked same fileds but i need formula which takes range F15:O15 and compare with range F6:O6 to check how many same in these cells.
Let's say your data is like this:
As you can see, only 3 cells are identical in both rows (range D4:F4 = range D5:F5)
The formula I've used in cell D8is:
=SUMPRODUCT(--(A1:J1=A2:J2))
And it returns 3 :)

Countifs does not work when a range with multiple column is selected

I need a count if function that counts me the cells that meet a certain criteria. This should be done with countifs. The formula is the following:
=COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:Q;">=1")This formula returns me an value type error.
This formula works well until I introduce the last condition orders!K:Q;">=1"
I would like a formula that counts if the word Ecolab is present in the cell; if the date is after or equal 01/01/2019; if the column U has more or equal than the number 36 and if there is at least a "1" in the cells in the row from column K to column Q. I could do this by easily replicating the countifs several times, (i.e =COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:K;">=1")+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!L:L;">=1")+...........+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!Q:Q;">=1")
But I would rather not include such a long formula as it would create confusion for the ultimate user of the excel sheet
Per my comment above, you could use SUMPRODUCT (avoid using whole columns for that) or an array with OFFSET like this:
=SUM(COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";OFFSET(Orders!J:J;0;{1;2;3;4;5;6;7});">=1"))
If the count for K:Q should be 1 when there may be more than one cell greater or equal to 1 in a single row then you need to apply OR criteria in a SUMPRODUCT.
SUMPRODUCT formulas should not use full column references; there is too much wasted calculation. The following is for rows 2:99; adjust for your own use.
=SUMPRODUCT(--ISNUMBER(SEARCH("ecolab", Orders!D2:D99)),
--(Orders!B2:B99>=DATE(2019, 1, 1)),
--(Orders!U2:U99>=36),
SIGN((Orders!K2:K99>=1)+(Orders!L2:L99>=1)+(Orders!M2:M99>=1)+(Orders!N2:N99>=1)+(Orders!O2:O99>=1)+(Orders!P2:P99>=1)+(Orders!Q2:Q99>=1)))

Excel - COUNTIF and SUMIF across multiple rows

I have a sheet with multiple columns of "Yes" / "No". I need to count the number of rows that have >5 "Yes". Obviously determining if an individual row should be included is easy using countif, but I can't figure out how to make the row 'eligible to be counted' and then sum the number of rows that meet my criteria.
Assuming your range is A2:Z100 this array formula will count the number of rows with 5 or more "Yes" entries
=SUM((MMULT((A2:Z100="Yes")+0,TRANSPOSE(COLUMN(A2:Z100)^0))>=5)+0)
confirm with CTRL+SHIFT+ENTER
or you can use this version with FREQUENCY
=SUM(IF(FREQUENCY(IF(A2:Z100="Yes",ROW(A2:Z100)),ROW(A2:Z100))>=5,1))
....which also needs "array entry"
or a third approach with COUNTIF - doesn't need array entry
=SUMPRODUCT(0+(COUNTIF(OFFSET(A2:Z100,ROW(A2:A100)-ROW(A2),0,1),"Yes")>=5))

How to find the total number of records in Excel?

I have an excel sheet with below data:
How to find the Total Number of records automatically. That is, if we add another record, say "J" to the sheet, then Total Number of records must be automatically updated to 10.
I've tried using COUNT and COUNTA formulas. But there is no use. Any suggestions?
You need to combine COUNTA with COUNT like this:
=COUNTA(A3:A11)-COUNT(A3:A11)
COUNT – this Excel function returns the number of cells in a range that contain numbers
COUNTA – this function returns the number of cells that are not empty
We know that the number of cells that contain text (not numbers!) is equal to the number of non blank cells – the number of cells containing numbers. In other words: COUNTA – COUNT. Src: http://www.excel-2010.com/count-the-number-of-cells-with-text-in-excel/

Check the number of unique cells in a range

I have an excel sheet.
Under column E, I have 425 cells with data. I want to check if the same data (i.e. text inside the cell) is repeated anywhere else in any of the remaining 424 cells under column E. How do I do this?
For example, in E54 I have
Hello Jack
How would I check this value to see if it was in any other of these cells?
You could use
=SUMPRODUCT(1/COUNTIF(E1:E425,E1:E425))
to count the number of unique cells in E1:425
An answer of 425 means all the values are unique.
An answer of 421 means 4 values are duplicates of other value(s)
Use Conditional Formatting on all the cells that will highlight based on this formula:
COUNTIF(E:E,E1) <> 1
This is based on the column being E, and starting on E1, modify otherwise.
In Excel 2010 it's even easier, just go into Conditional Formatting and choose
Format only unique or duplicate values
If you have to compensate for blank cells, take the formula supplied above by #brettdj and,
Adjust the numerator of your count unique to check for non-blanks.
Add a zero-length string to the COUNTIFS's criteria arguement.
=SUMPRODUCT((E1:E425<>"")/COUNTIF(E1:E425,E1:E425&""))
Checking for non-blank cells in the numerator means that any blank cell will return a zero. Any fraction with a zero in its numerator will be zero no matter what the denominator is. The empty string appended to the criteria portion of the COUNTIF is sufficient to avoid #DIV/0! errors.
More information at Count Unique with SUMPRODUCT() Breakdown.
This formula outputs "unique" or "duplicates" depending if the column values are all unique or not:
{=IF(
SUM(IF(ISBLANK(E1:E425),0,ROW(E1:E425)))
=
SUM(IF(ISBLANK(E1:E425),0,MATCH(E1:E425,E1:E425,0)))
,"unique","duplicates")}
This is an array formula. You don't type the enclosing {} explicitly. Instead you enter the formula without {} and then press cmd-enter (or something else if not a Mac - go look it up!) If you want to split your formula over multiples lines for readability, use cmd-ctrl-return on a Mac.
The formula works by comparing two SUM() results. If they are equal, all the nonblank entries (numeric or text) are unique. If they are not equal there are some duplicates. The formula does not tell you where the duplicates are.
The first sum is what you get by adding up the row numbers of every non-blank entry.
The second sum does a lookup of each nonblank entry using MATCH(). If all entries are unique, MATCH() finds each entry at its own position, and the result is the same as the first sum. But if there are duplicate entries then a later duplicate will match an earlier duplicate and the later duplicate will contribute a different value to the sum, and the sums won't match.
You might have to adjust this formula:
if you want cells containing "" to count as blank, then use LEN(...)=0 for ISBLANK(...). I suppose you could put other tests in there if you wanted, but I have not tried that.
if you want to test an array not starting at row 1, then you should subtract a constant from ROW(...).
if you have a huge column of cells, you might get integer overflow when computing this sum. I don't have a solution to that.
It's a shame that Excel does not have an ISUNIQUE() function!
This may be a simpler solution. Assume column A contains data in question. Sort on that column. Then, starting in B2 (or first non-blank cell, use the following formula:
=IF(A2=A1,1,0).
Than sum on that column. When sum = 0, all values are unique.
highlight E and on the home tab select conditional formatting > Highlight Cell Rules > Duplicate Values...
It will then highlight everything that is repeated.

Resources