Get Average from range with criteria - excel

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)

Related

Excel - Find matching values and copy different cell

I have 2 Excel spreadsheets and both sheets have a "Code" field and value that may or may not exist in both. In sheet1 and sheet2 there is also an "ID", i'm hoping that if the "ID" is populated in sheet1 and if the matching code exists in sheet2, a query can transfer the "ID" to sheet 2
SHEET1
|
SHEET2
I can find the matching values using vlookup but my issue is getting the ID field to populate
=VLOOKUP(A1,Sheet1!A:A,1,FALSE)
Instead: =VLOOKUP(A1,Sheet1!A:B,2,FALSE).
From Microsoft's help on Vlookup:
How to get started
There are four pieces of information that you will need in order to build the VLOOKUP syntax:
The value you want to look up, also called the lookup value.
The range where the lookup value is located. Remember that the
lookup value should always be in the first column in the range for
VLOOKUP to work correctly. For example, if your lookup value is in
cell C2 then your range should start with C.
The column number in the range that contains the return value. For
example, if you specify B2:D11 as the range, you should count B as
the first column, C as the second, and so on.
Optionally, you can specify TRUE if you want an approximate match or
FALSE if you want an exact match of the return value. If you don't
specify anything, the default value will always be TRUE or
approximate match.
Pay special attention to parameters 2 and 3.
Note that number 2 "The range where the lookup value is located" should be the full range where the first column of the range has the values to lookup and the last column of the range should contain the values you want to return. So your A:A only having one column, will only lookup and return values in column A. You want values returned from column B so it must be included as well, to become A:B.
Since column B is the second column in the lookup range of A:B then your third parameter will be 2 which leads to the vlookup at the top of this answer.
This is what you are doing:
VLOOKUP(A1,Sheet1!A:A,1,FALSE)
(I will only talk about Sheet1!A:A and 1)
You are looking into column A and from there you are taking column number 1 (which is column A).
What you should be doing, this this:
VLOOKUP(A1,Sheet1!A:B,2,FALSE)
Look into table, made up of columns A and (up to) B, you will automatically look into the first column, and you return the value you find in column number 2 (which is column B).

Excel Sum Formula With Multiple Criteria

So I'm having a problem with summing some data in a range with multiple criteria. Take the data below as an example:
I would like to sum all numbers where: Name = Bob AND the top row is equal to 02/01/20.
The current formula i have is with a SUMPRODUCT, but i'm not sure if it's the solution
=SUMPRODUCT((Names="Bob")*(Dates="02/01/2020")*Values)
Where Names is a named range for my names, Dates is a named range for my dates and Values is a named range for all my values in the table. However, the formula keeps resulting in "#VALUE!".
Any ideas anyone?
You need to turn your date string into a date value. So try:
=SUMPRODUCT((Names= "Bob")*(Dates=--"02/01/2020")*Values)

Match several results with same conditions

The aim of my workbook is to show result from a spreadsheet, after applying filters.
In this example,
I get my spreadsheet in range A1:C13,
in column E, thanks to the Yellow formula,
It shows every Done date by unsorted.
The problem is that I want to show relative Name in column F. But there is some equals dates for different names,
My reflex where to do an Index Match, but it can't show when there is several results from the same conditions.
Any ideas ?
Change your formula to include the Name column in the output:
=SORT(FILTER(Table2[[Date]:[Name]],Table2[Statut]=E1),1,-1)
If your data is not right next to each other and you do not want the middle columns to show in your output then we use the same formula wrapped in INDEX to return the correct column of the array:
=INDEX(SORT(FILTER(Table2[[Date]:[Name]],Table2[Statut]=F1),1,-1),0,1)
And
=INDEX(SORT(FILTER(Table2[[Date]:[Name]],Table2[Statut]=F1),1,-1),0,3)
Where the ending ,1 in the first formula refers to the relative column in the referred to range of the date, and the ,3 in the second refers to the relative column in the referred to range of the Name

Excel if Function,select cell in line with match

Here is my problem .
I have an excel workbook with 2 sheets with the same fields but different amount of records. Both sheets have an ID field and date field.
If the ID from column a of sheet 2 exists in column a of sheet 1 then I want to use the date field from sheet 2 to populate the date field in sheet 1 for that matching ID.
Please help me figure this out. I can post sample data.
Thank you
As suggested by #L42 VLOOKUP can be used for your situation. A simple example mentioned below can guide you to adopt it to your situation.
There are four pieces of information that you will need in order to build the VLOOKUP syntax:
The value you want to look up, also called the lookup value.
The range where the lookup value is located. Remember that the lookup value should always be in the first column in the range for VLOOKUP to work correctly. For example, if your lookup value is in cell C2 then your range should start with C.
The column number in the range that contains the return value. For example, if you specify B2: D11 as the range, you should count B as the first column, C as the second, and so on.
Optionally, you can specify TRUE if you want an approximate match or FALSE if you want an exact match of the return value. If you don't specify anything, the default value will always be TRUE or approximate match.
Now put all of the above together as follows:
=VLOOKUP(lookup value, range containing the lookup value, the column number in the range containing the return value, optionally specify TRUE for approximate match or FALSE for an exact match).
In the sample data shown in the sheet1 and sheet2. Shee2 has ID column and Date column. Formula to be put in cell B2 of Sheet1 is:
=VLOOKUP($A2, Sheet2!$A$2:$B$6,2,0)
Fill down the formula and it will correctly pick dates from Sheet2 and fill in sheet1. Sample data screenshots are placed below.

Excel vlookup return not available

i want to fill the name column using vlookup, here is my transaction table
and here is my master file
yes, they're the same number, but why do my vlookup doesn't return the corresponding name based on looked up value ?
does vlookup comply with data type ? like text, or number, or general ?
i have changing the data type, over and over, and return the same "Not Available"
is there anything wrong with my excel 2007 ?
You should use Index/Match like this:
=INDEX(Phonebook!$A$2:$A$45,MATCH(B2,Phonebook!$B$2:$B$45,0))
Your Vlookup doesn't work, because it tried to find value from B2 in first column of range Phonebook!$A$2:$B$45, i.e. Phonebook!$A$2:$A$45
What's wrong is that VLOOKUP is looking for the phone number in the first column, meaning in column A. For 'backwards lookup', you will need to use INDEX and MATCH:
=INDEX(Phonebook!$A$2:$A$45,MATCH(B2,Phonebook!$B$2:$B$45,0))
INDEX is as follows:
=INDEX(Range, Row Number, [Column Number])
It will return the value a cell from the range Range that is on the row number Row Number and column Column Number. I have put Column Number between square brackets because it is optional (you have only 1 column if you have a range that is within A:A for example)
To get the row number, you can use MATCH like the above. It works a bit like VLOOKUP, but instead of returning the value of the matching cell, it returns the row number of the matching cell (or column number if you use it on a horizontal range).
MATCH(B2,Phonebook!$B$2:$B$45,0) thus looks for B2 in the range B2:B45 of the worksheet Phonebook (0 stands for exact match) and gives the row number.
Then, you tell Excel to return the value of the cell from the range Phonebook!$A$2:$A$45 and row number obtained from MATCH.

Resources