I am working on a table with thousands of entries. I am looking for a formula that will count all the records in the column A that have data in column B.
Some cells from column A could be merged and being represented by 2 entries in column B which are 2 cells. It is like one cell in column A have 2 cells in column B, being altogether one line. I hope I made myself understandable.
I tried to use like countif, but it's not the case I guess...
I have attached a little example in the below link.
Hope there is someone that could help me with that.
=SUMPRODUCT(--(A1:A5<>"")*--(B1:B5<>""))
The above counts the number of rows where A is not blank and B is not blank
Related
I have two large columns.
Column A contains 100,000 different numbers/rows. Column B contains 100,210 numbers/rows. They have the same numbers except column B has 210 extra rows. I need to be able get the values of that extra 210 rows.
The issue im having is that the numbers in these rows are not unique.
For example,
Column A contains the following numbers: 2,1,3,4,5,5,6,7
Column B contains the following numbers: 1,2,3,4,5,5,5,5,6,6,7,8
I want the outcome result to be: 5,5,6,8
I can't seem to wrap my head around a way to do this.
I have the two columns in a text file that im importing into excel. If there are better ways to do it outside of excel, I am open to it too.
With the Dynamic Array formula Filter:
=FILTER(B1:B12,COUNTIF(OFFSET(B1,0,,SEQUENCE(ROWS(B1:B12))),B1:B12)>COUNTIF(A:A,B1:B12))
Without FILTER:
Put this in the first cell and copy down:
=IFERROR(INDEX(B:B,AGGREGATE(15,7,ROW(B1:B12)/(COUNTIF(OFFSET(B1,0,,ROW(INDEX($ZZ:$ZZ,1):INDEX($ZZ:$ZZ,ROWS(B1:B12)))),B1:B12)>COUNTIF(A:A,B1:B12)),ROW($ZZ1))),"")
Try to follow these steps, supposing that Column A has less values than the Column B and the rows start at 1:
A. Create Column C.
In the cell C1 place the function: =COUNTIF(A:A;B1)
Copy this function to the rest of cells, for all items of Column B. So, cell C2 will have the function =COUNTIF(A:A;B2) and so on.
B. Create column D.
In the cell D1 place the function: =COUNTIF($B1:$B1;B1)
Copy this function to the rest of cells, for all items of Column B. So, cell D2 will have the function =COUNTIF($B$1:$B2;B2) and so on.
C. Create column E.
In the cell E1 place the function: =IF(D1<=C1,"Exists","Missing")
Copy this function to the rest of cells, for all items of Column B. So, cell E2 will have the function =IF(D2<=C2,"Exists","Missing") and so on.
D. Filter to show only the rows that Column E values are "Missing".
Of course you can combine all above 3 columns to one (e.g. in Column F), so these cells will have the functions:
F1: =IF(COUNTIF($B$1:$B1,B1)<=COUNTIF(A:A,B1),"Exists","Missing")
F2: =IF(COUNTIF($B$1:$B2,B2)<=COUNTIF(A:A,B2),"Exists","Missing")
and so on
Explanation:
In column C we count how many times the value of the respective cell
of Column B exist in the whole Column A.
In Column D we count how many times we have "met" this value in Column B so far.
In Column E we check if we have "met" the value more times that it exists in Column A. If indeed we have "met" it more times, then we mark the cell as "missing"
Tested with the example you provided and works okay.
I hope it helps!
Good luck!
EDIT - Addition of Screenshot
I have column A containing number ID. Each row in column A is Unique.
I have column B containing City names. Each row In column B is unique.
I have column C with duplicated city names from Column B. Duplications are random. One city is duplicated 2 times and another 10 times and so on.
What I would like to achieve is to assign the number ID from column A to duplicates in column C. Each different duplicate should have number Id in a form A1+1.
Notice that Alexander in Column D has value from A2, along with all duplicates. Alma is next with ID 499. Those are manual entries of course.
Can anyone provide a formula to automate this?
I'm using Google Spreadsheets..
You would use INDEX/MATCH, put this in D2 and copy down:
=INDEX(A:A,MATCH(C2,B:B,0))
try this:
Clear data from column D.
Paste ArrayFormula into cell D2.
Here's the formula:
=ARRAYFORMULA(VLOOKUP(OFFSET(C2,,,COUNTA(C2:C)),{B2:B,A2:A},2,0))
I think I had to insert a column A with same values as Column C in order to get Vlookup to work, as I believe it indexes off of the 1st column always.
I have a list of 190 column c values that correspond to specific column a and column b values. I created a huge if statement, but excel says it's too large and I keep messing up parentheses. What is a more efficient way to solve this problem? For example, if column A is "United" and column B is "Brain", I want column C to be 150. All for the first value. Thank you.
If your data is in column A and B. Use concatenate in column C:
Concatenate(A1, B1)
Then in your sheet with the values, insert a column between the values column and the two criteria columns. Use concatenate in that column as well (sane formula as above).
Then on the first sheet in column D use the formula:
vlookup(C1, Sheet2!C1:D190, 2, false)
This is assuming your second sheet is sheet 2 yadda yadda.
Let me know if you run into an issue!
I have two columns in excel that have some shared data and some unique data to each column. What I want is to have two more columns that will have the data that is in Column A but not B and the data that is in Column B but not in A. I have tried using Vlookups but I don't think I can get what I am looking for by doing this.
For Col A items not in column B, try this array-entered formula (entered in some cell, then fill down until it returns blanks)
=IFERROR(INDEX(ColA,SMALL(IF(ISNA(MATCH(ColA,ColB,0)),ROW(ColA),""),ROWS($1:1))-1),"")
and for Col B items not in Column A:
=IFERROR(INDEX(ColB,SMALL(IF(ISNA(MATCH(ColB,ColA,0)),ROW(ColB),""),ROWS($1:1))-1),"")
The formulas assume that your data starts in row 2 (row 1 would be a label) and the ranges ColA and ColB also start in Row 2
The formulas also assume no blanks in the data. If there are empty cells, then use these formulas:
=IFERROR(INDEX(ColA,SMALL(IF(ISNA(MATCH(ColA,ColB,0))*(ColA<>""),ROW(ColA)),ROWS($1:1))-1),"")
=IFERROR(INDEX(ColB,SMALL(IF(ISNA(MATCH(ColB,ColA,0))*(ColB<>""),ROW(ColB)),ROWS($1:1))-1),"")
Example Image:
Easy with a PivotTable, if you are prepared to rearrange your data somewhat:
IN row A i am having Date (Date might be today's date, yesterday’s date and day before yesterday's date)
In Row B i am having person name (Name Can be Arindam , Samir,Amit,Din
In Row C I am having the work status (Ctatus Can be Closed,Work in progress,Waiting,New
Now I want the Close Count status of Row C in Row D, but condition should be” if Row A is today's date and Row C is Arindam.”
Is it possible by excel formula?
Please help me out
This works for me, but there are a LOT better ways to organize your data (like with Tables and named Columns) that will make this kind of thing easier.
=IF(AND(A1=TODAY(), B1="Arindam"), C1, "")
You can "fill" that formula down the whole column D and the row number will auto-adjust. You might need to edit the A1/B1/C1 to match the row you actually paste this into (probably row 2 or greater, if you have a header row).
Op asked a follow-up that couldn't be easily answered in a comment.
From Excel help:
The COUNTIF function counts the number of cells within a range that
meet a single criterion that you specify.
COUNTIFS is a more complex variation of that.
For the original example given, the simple IF() above works correctly. COUNTIF is meant to count the NUMBER of cells (not to sum them) that meet certain criteria (like Date>Today, Count>3, or anything). There is a SUMIF that will sum up cells, but you didn't say you want to sum up cells, you said wanted the "Close Count status of Row C in Row D".
If instead you want a cell (not necessarily in column D, associated with the data in a single row) that "sums" up all of a given Close Count on a page, you could do this:
=SUMIFS(C:C,A:A,"="& TODAY(),B:B,"Arindam")
That's really great for a summary of ALL the rows of data, but it sounded like you wanted a summary per row, for which you should use the simpler IF() given above.
OK, one more update, now that I'm understand the original data better. This can be done in EACH row, and if you really want a total for the entire set of data, you'll have to have a total row (or separate sheet) that adds up column D:
=IF(AND(A1=TODAY(), B1="Arindam", C1="Closed"), 1, "")
This puts a "1" in column D if the criteria in columns A, B, and C match what you want.
If you want a single cell that sums up all the matches, then Jerry gave the correct answer (this is from him, and I think it's the best answer, although it was in the comments):
=COUNTIFS(A1:A10,TODAY(),B1:B10,"Arindam",C1:C10,"New")