Excel formula to find amount of columns filled - excel

I hope everyone is having a great day. I have an excel file where the employees ID number is in column A. Then I have 4 other columns that tell me if an employee filled out data for Degree, Work Experience, Experience Level and Languages known. The employee may appear more than once therefore creating several lines for the same employee.
I need to know of a formula that will detect how many of the lines the employee has filled in. The trick here is for example if an employee has already filled in the four columns in any one of the rows to just appear as complete.
I tied using an IF formula but its not working for me.

There is no need for VBA. As I suggested in my comments above, add a helper column (Let's say in B) and put the formula mentioned below in cell B2 and pull it down.
=IF(COUNTA(C2:F2)=4,"Complete","")
Output

Try the UsedRange property.
E.g.,
ActiveSheet.UsedRange.Columns.Count

Related

Filtering or Importing data for specific date

I was wondering if anyone knows if it's possible to import a data, in a sort of a COUNTIF function but only for the data dated today?
I have 2 sheets, Attendance and Department.
In the Department tab, I have a list of employee's in column A. In column B and so on, I have a drop down option to select which department they're are stationed for each day. Each column represent a day, B being the 1st, C being 2nd, ... and so on. The header for each column has the day for the day as well.
On the attendance sheet, I have the list of Department in column A and in B, it is used to record how many employee are stationed at that department. I also have the day for the day on this sheet on A1.
Is it possible that when I change the date, the number of employee stationed in each department will change according to the date?
Is it possible to do this with just functions?
I've tried using the COUNTIF function, but I've found that I will have to change the range on a daily basis.
Use The Function: in B4 of Attendance Tab
=COUNTIF(INDIRECT("Department!" &ADDRESS(3,MATCH($A$1,Department!$A$2:$P$2,0)) & ":" &ADDRESS(6,MATCH($A$1,Department!$A$2:$P$2,0))),$A4)
Results: Attendance Tab
Department Tab:
I have used all the references as in the screenshots, you can change them if they are different in your sheet.
your question can be solved by SUMPRODUCT function. See below solution picture:
SOLUTION
Just to quickly explain my solution, I gave a name to the date on the Department sheet, called it 'Date_Lookup'; and I gave a name to the dates on the Attendance sheet, called it 'Date_List'. Names will simplify my formula especially when referencing across worksheets.
You will eventually find a lot of COUNIF scenario can be solved by SUMPRODUCT and this is just one example. SUMPRODUCT can do a lot IFs than COUNTIFS can do. In your case there are two criteria, one is which department did an employee attend to, and the other is on which date did the employee attend to that particular department. So my SUMPRODUCT formula can be understood as:
=SUMPRODUCT(('from the list of dates'='the particular date I want to see')*('from the full attendance record'='how many employees went to the given department'))
Let me know if you have difficulties understand my answer. A good 1 hour read through some online articles regarding SUMPRODUCT will help.
Cheers :)
Your first step would be to use a function to work out in which column the entered date appears. So in your Department sheet you enter a date in A1, then set B1 to:
=IFERROR(MATCH(A1, Attendance!2:2, 0), 0)
I use the IFERROR as I don't like seeing errors on my sheet. Assuming the result isn't zero, use a COUNTIF looking for the department letter in a range in the result column. I'd simply use on OFFSET to get the right range, but sticklers would tell you to find a different way of doing it. So long as your spreadsheet isn't going to increase in size to a massive complexity, OFFSET is fine.

Vlookup to find number of instances two items appear with a pivot table

Not sure how to work this, but I think a previous post had me on the right track, but I'm stuck in this particular situation.
Sheet1 is raw data (material number in A:A, Created by user in D:D, username in C3). second tab (PVT) is a pivot table documenting the number of occurrences a specific material appears in Sheet1. I need to look at the material in the pivot table, find out how many times user listed in C3 is found next to that material number in Sheet 1.
=COUNTIF(Sheet1!D:D,VLOOKUP("WYGLADALB",A:A,0))
This is what I'm currently using, but obviously this isn't correct. Here is a sample spreadsheet.
Use COUNTIFS()
=COUNTIFS(Sheet1!D:D,C3,Sheet1!A:A,"WYGLADALB")

Can I pull correct values for a variable from an old spreadsheet into a new one that's missing those values?

I have an excel spreadsheet with several columns, each representing different variables collected from various patients (rows). One of the columns is the unique medical record #, another is a unique visit identification #. The problematic one is "age." I must have inadvertently dragged and replaced the ages of about half of my subjects, since I doubt that >3000 of my 6000 patients are 54 years old.
I have the original file with correct ID# and age pairs, but I've done considerable work on this file and cannot start over. Is there a way in my new file to look at the ID# in column C, go to the old excel file, find that ID#, go over 3 cells to column F (age), copy that age value, go back to the new excel file and paste the correct age for each ID#?
I cannot simply sort both files by ID# and copy/paste all of the ages as a number of the cases have been intentionally removed and so the ID#s wouldn't match up because the total N is different.
I also have SPSS and R available to me, although I'm not particularly proficient with either.
Just, as an example, here's what the two spreadsheets look like:
http://imgur.com/OjZsLEJ
I've manually highlighted the bad values, but in reality there are 3000+ of them and manually checking would be very time consuming.
Thanks in advance!
A VLOOKUP function should work here:
=VLOOKUP(C3,[OldWorkBook.xlsx]Sheet1!$C:$F,3,FALSE)
If you place this function in Column C, Row 3 of the New Workbook and then change "OldWorkBook.xlsx" in the function to reflect the name of your old Workbook, it should return the correct value from your old Workbook.
You can then copy that formula and paste it into the remaining cells in that column.
If the values are correct, you can copy them, Right-Click and select "paste values" to solidify them in your new workbook.
If I've understood your question, that should fix the problem. If not, please let me know.
You can do that with a VLOOKUP formula.
It should look like this (check if the cell references are right, and also the file and sheet name).
You should put this in a new column in your "NewFile".
The formula references the "OldFile" and should bring the value for the "F" column in the "OldFile" whenever the values for the "C" column are the same.
This example would be for the second row of the file (I am assuming the first row are column headers).
=VLOOKUP(C2,'[OldFile.xls]Sheet1'!$C$2:$F$6000,4,FALSE)

How to display rows that contain data present in several columns (Excel and/or Google Spreadsheet)

I've been searching for a solution to my problem for days and haven't had any luck. Maybe I simply can't manage to search for the right wording for this problem but hopefully somebody will understand me here.
I'm having difficulties displaying data that is present in several columns at the same time, in my case the data to be displayed are trading days for various stocks. As the trading days vary between stocks I would like to have a column that displays the dates present in all other columns to only see trading days in common for all stocks.
I apologize if I'm unclear as this is my first question here. If anyone could point me in the right direction I would greatly appreciate it.
Here's the google spreadsheet link so you can see what I mean by different amount of trading days. The idea is to have column A display dates which are present in columns B,F,J,N,R,V at the same time but not show the other ones.
https://docs.google.com/spreadsheets/d/19GsIAtEdWPGcBfNOPaeqNVB7QQNO-bOyg-dCZzDaGkQ/edit?usp=sharing
EDIT: To show the desired output I'm looking for, here's another example:
https://docs.google.com/spreadsheets/d/1jrIqaEzDPWcW4hkF2YdHq9XYIWjG8PhrewYrBHqEdVY/edit?usp=sharing
The dates are automatically pulled from google finance. As the various exchanges are open on different dates, each stock has a varying amount of open days in columns B-E.
What I'm trying to do is have a formula in Column A that checks all the other columns and returns the data (in this case the date) that appears in every other column, discarding the data that doesn't appear in all other columns. For example 3/9/2013 appears in all columns B-E therefore it is shown, however 12/09/2013 doesn't appear in column B therefore it isn't shown.
Cheers
your dates are in european (UK) style, ie: 31/12/2014 but your spreadsheet is saved as US standard. This will cause some dates to be stored as text, as they are considered invalid. Ti will also couse unexpected results if you try to do any calculations or comparisons using your data. Go to File -> Spreadsheet settings and under locale choose correct country.
Then select all date columns, and click format->number->date or click the 123v button on tool bar, and choose date.
to simplify your problem:
for a value to be repeated across all 6 columns, that value must appear in column B.
you therefore want column A to contain the value of the adjacent cell in column B, if that value also appears anywhere in column F,J,N,R and V.
to check if value of B4 appears in column F you can use COUNTIF function. If the result if >0, than value of B4 appears in column F. Repeat for all columns and combine to achieve the following formula (to go in cell A4) :
=if(countif(F:F,B4)*countif(J:J,B4)*countif(N:N,B4)*countif(R:R,B4)*countif(V:V,B4),B4,)
now copy this formula down, and only dates that appear in all columns will be displayed in column A.
Use IF and COUNTIF. I think this is what you are looking for.
IF(COUNTIF(B4:V4,B4)=6,B4,NA())

Find and Compare Two Columns Excel (With Screenshots)

I have a spreadsheet that will occasionally get new data that I don't know the contents of, I just have to add it to the spreadsheet. Some of the new data is just updating rows that are already in the spreadsheet, and other data is adding new rows. I'm looking for a way to add a column that will tell me if something has changed in the row when I compare the old spreadsheet to the new one.
The sheets have one column that will always have a unique value among all the rows, so I can use that to match rows if the sheets aren't sorted the same way. Here are some screenshots to show what I'm trying to do:
Old Spreadsheet:
New Spreadsheet:
The only solution I can think of is a large nested IF formula that compares each column one by one, something like:
=IF(Old!B2=New!B2,IF(Old!C2=New!C2,"NO","YES"),"YES")
The problem with that is that it gets very hard to look at since my actual data is using 33 columns (not including this "Changed?" column) and new columns could be added in the future.
I'm not very technical with Excel, nor have I ever used VBA, so I apologize in advance if there is a simple/obvious solution that I'm missing.
Thanks in advance for your help.
Using your example, in the 'New' sheet cell D2 and copied down:
=IF(COUNTIF(Old!A:A,A2)=0,"YES",IF(SUMPRODUCT(COUNTIF(INDEX(Old!A:AG,MATCH(A2,Old!A:A,0),0),LEFT(A2:AG2,254)&"*"))=SUMPRODUCT(COUNTIF(A2:AG2,LEFT(A2:AG2,254)&"*")),"NO","YES"))
vlookup would also work well for this problem.
in D2, the formula would be:
=IF(AND(VLOOKUP(A2,Old!A:C,2,FALSE)=B2,VLOOKUP(A2,Old!A:C,3,FALSE)=C2),"NO","YES")
The column numbers (2 and 3) are the columns that correspond to the data you are trying to match, using the ID column.
It's possible to find the appropriate column using MATCH if the column names you have match the column names in the old sheet
This would make the formula look more complex, but Excel would adjust the Old!A:C reference if more columns are inserted.
The formula would look like this to match against column names
=IF(AND(VLOOKUP(A2,Old!A:C,MATCH($B$1,Old!$1:$1,0),FALSE)=B2,VLOOKUP(A2,Old!A:C,MATCH($C$1,Old!$1:$1,0),FALSE)=C2),"NO","YES")
The difference between this and the last one is the use of MATCH($B$1,Old!$1:$1,0) to find the column (using $s to anchor the lookup values)
In this case, specialized software for Excel compare is better.
My company use this software. Check it out.
http://www.suntrap-systems.com/ExcelDiff/
http://www.youtube.com/watch?v=QQgnWr_RT-8

Resources