SUM of VLOOKUP functions meeting criteria in Excel - excel

Sorry for the macabre subject matter, but I need to add the ages up of a group of people IF they have died.
My data is structured as follows:
Sheet A has the list of people to analyze.
Sheet B is an essential database of all people, with a Yes/No column for if they are alive, and another column for their age.
Basically, I want to get the SUM of ages of the people on a list on Sheet A IF the person is dead.
In my head, it combines the VLOOKUP, SUM and IF functions, but not quite sure how. I want the result in ONE cell.
Thanks for any suggestions!
For formula matters, let's assume the data is structured as below, with the highlighted cell where I want the formula to say 60:

Due to the data structure you provided if you only want to sum the names in Group 1 that are dead then you would use:
=SUMPRODUCT(SUMIFS(E:E,F:F,"No",D:D,B1:B3))
If the Names are not important then use #JoeJam's answer.

You can use =SUMIF(C2:C4,"No",B2:B4) where the age is in column B and Yes/No is in column C.

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.

ExcelNewbie: Matching cell information across worksheets

Please forgive me if this is simple...I am not an Excel expert and this is causing my nose to bleed(!)
Firstly I am using Excel 365.
I am working on a Bonus Calculator Sheet and the system is VERY complex, but I have reduced it to a two column table.
Column A is the company success "number" and column B is the % bonus it draws. This is all on worksheet B.
Worksheet A contains salary stuff and the company success number sits at the top and is not changed. What I need to do in pseudocode is:
Take value from Sheet A Cell A1
Find match in Sheet B Column A.
Return value next to it in Column B to Sheet A somewhere.
My life is mainly spent in the world of Python and this looks SO simple - but any help you experts could offer would just make my day rosier...if anyone can help I will give my two dogs a biscuit to show the love(!)
Thanks.
Seems pretty simple.
=VLOOKUP(A2,SheetB!A:B,2,FALSE)
You could also try using index match formula
=INDEX(SheetB!B:B,MATCH(A1,SheetB!A:A,0))
Where A1 is the value that you want to lookup in SheetB in range A:A.

INDEX&MATCH excel on rows and return SUMPRODUCT

I needed some help with Excel functions as I am not really sure how to achieve this.
Basically, this picture shows my data structure:
I am aware that I can use Index& Match excel functions together for columns but I am not sure if it is possible use Index&Match together on two row conditions.
Requirement:
I have three products, product A, product B and Product C. I want to be able to quickly calculate the actual revenue and and you can see the data structure in the image above. My top-most row is month. For each month, I have 4 columns, of which 2 need to be calculated should the condition match.
This is the condition. An example, for product A, calculate the total sumproduct(multiples column actual customers x Price Actuals) for yearMonth 201501.
So basically,first, for product A, it would need to find YearMonth 201501, and when it is found, it should find columns Actual Customers and Price Actuals and return the SUMPRODUCT of Actual Customers and Price Actuals.
Is it possible to do this?
I have searched the Internet a bit and I have not found a solution.
Update:I thought I could post the follow-up question in the same thread insted of Cristiano duplicates... For the accepted answer, in the excel formula, how can it be divided by the total amount of "actual customers" for that month?
Simply adding "actual customers" with a slash before IT does not work.
You need a cell where you specify the month you want to look up. Give that cell the name "TheMonth".
You need a cell where you specify the product you want to look up. Give that cell the name "TheProduct".
Then, assuming your screenshot starts in cell A1, you can use
=SUMPRODUCT($B$3:$I$5*($B$1:$I$1=TheMonth)*(($B$2:$I$2="Actual Customers")+($B$2:$I$2="Price - Actuals"))*($A$3:$A$5=TheProduct))
Next time, please post a link to a workbook. It's not much fun typing in the text and numbers from a screenshot in order to verify a formula.
Here is the workbook with the formula in action.

Excel formula to find amount of columns filled

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

Return a value relative to every instance of a search term

I have a spread sheet populated with dates (Months) and revenue figures. The sheet is structured with numerous tables all containing these month-revenue pairings but they are not all in the same columns.
I need to be able to search the whole range of cells for a given month and then each time the month is found I need to look across for the revenue figure (5 cells to the right) and return the answer.
The answer returned needs to give the total figure for all instances of the search term.
VLookup won't work because there are multiple tables and they are not all lined up.
Any advice would be very gratefully received.
Thanks
You should use a VBA script for that, IMHO this is not possible to do in a formula. Here is a rough outline what you need to do:
Define an array of the month names as they appear in you sheet
Iterate this array and for each month name find all cells containing it (this might help)
Iterate all cells of each month and do your calculation based on this cell (find a cell with a certain offset or whatever)
If you cen provide a more specific description of your problem (preferably with example data/images), maybe we can give you a more specific answer.

Resources