. Use "DAVERAGE" function to calculate the average price of each product ?excell - excel

I have following data
6489 O-Ring 3.00
6431 O-Ring 2.85
6433 O-Ring 2.95
6321 O-Ring 2.45
8008 Machined 645.00
8148 Machined 655.50
I am using formula
=DAVERAGE(D131:F134,E132,F131:F134)
But returns error !DIV/0
i need the exact way to calculate the daverage of my values in list

Your values are text, not numeric, change them to numbers, i.e. enter 3, 2.85 in the top 2

First, you need to add headers to your Database that you are trying to get the Daverage function to work on (see screen-shot below).
Then use the formula:
=DAVERAGE($D$131:$F$137,"Price",H131:H132)
With respective to the format in the screen-shot below (also your "criteria" need headers for the Comparison to work on, Columns H and I):

Related

Excel - Find row with conditional statement in XLOOKUP

I'm trying to use XLOOKUP to find a value based on user inputs.
The table looks like this:
Type Start End 33 36 42 48
---------------------------------------
4002 1 7 1.17 1.34 1.5 1.84
4002 8 12 1.84 1.67 2.1 3.45
User selects type, number (can be between start and end), and 33-48
I can nest an XLOOKUP to specify the 3 criteria
=XLOOKUP(*type* & *number* , *typeRange* & *numberRange* ,XLOOKUP(*33-48* , *33-48Range* , *ResultRange* ))
And I can find if a value is between the columns
=IF(AND(*number*>=*Start*,*number*<=*End*),TRUE,FALSE)
Can I combine the two? The data is redundant for numbers 1-7, and I would like to keep the table small.
You sort-of can combine them. I have added a couple of extra rows to the table to see what would happen if you had different Type values as well as number values. The problem then is that if you used approximate match and put in a number like thirteen which is out of range, you might end up getting the next row of the table which would be incorrect. One way round it would be to use the options in Xlookup to search for next-smaller-item in the Start column and next-larger-item in the End column and see if the results match:
=IF(XLOOKUP(I2&TEXT(J2,"00"),A2:A7&TEXT(B2:B7,"00"),XLOOKUP(K2,D1:G1,D2:G7),,-1)=XLOOKUP(I2&TEXT(J2,"00"),A2:A7&TEXT(C2:C7,"00"),
XLOOKUP(K2,D1:G1,D2:G7),,1),XLOOKUP(I2&TEXT(J2,"00"),A2:A7&TEXT(C2:C7,"00"),XLOOKUP(K2,D1:G1,D2:G7),,1),"Error")
If you have some checks in place which make it impossible for number to be out of range, then you can simplify the formula:
=XLOOKUP(I2&TEXT(J2,"00"),A2:A7&TEXT(B2:B7,"00"),XLOOKUP(K2,D1:G1,D2:G7),,-1)
or
=XLOOKUP(I2&TEXT(J2,"00"),A2:A7&TEXT(C2:C7,"00"),XLOOKUP(K2,D1:G1,D2:G7),,1)

create formula with sumif,if and ,or

I want to make formula with sumif and with conditions i tried but its failing to provide sum.I want to find value if conditions:
1. G/L is 62810101 or 62810100 then value for 81810101 and 81810100 should be calculated or vice versa.
2.If code is A2+B2 then value for B2+A2 should be find in document currency.
i tried something like this... =IF(OR(E2=62810101,E2=62810100),SUMIFS(I:I,L:L,L2,E:E,E2=81810101))
CoCd Tr.Prt DocumentNo Reference G/L Doc. Date Amount in local cur. LCurr Amount in doc. curr. Curr. Code 1 Sum if 1
BG05 RS31 1100000007 111 62810100 42081 2542.58 BGN 1300 EUR BG05RS31 2918
BG05 RS31 1100000017 1100000017 81810101 42234 621.95 BGN 318 EUR RS31BG05 318
Try these formula:
For Accts Receivable:
=SUM(SUMIFS(I:I,L:L,L2,E:E,{62810101,62810100}))
For Accts Payable:
=SUM(SUMIFS(I:I,L:L,L2,E:E,{81810101,81810100}))
It is just a matter of putting the wanted account numbers in the {} brackets.

Return corresponding date of max value

I'm looking for a formula which will give me the date of the last version of the order.
To illustrate, the sheet looks as follows:
A B C
1 Sales Order Version Date
2 SO#12345 1 21/02/2013
2 SO#12345 2 28/04/2013
3 SO#12345 3 04/08/2013
4 SO#12345 4 27/09/2013
5 SO#54321 1 02/03/2014
6 SO#54321 2 31/03/2014
7 SO#54321 3 07/10/2014
8 SO#54321 4 13/12/2014
So I would like to get the date of SO#12345, version 4 (29/09/2013).
I've tried several combinations of INDEX, MATCH, IF and MAX functions, but I can't seem to get the right value.
It either gives me the corresponding date of the highest value in the version column or it gives me the correct version number, but I can't make it show the appropriate date.
I did use CTRL+SHIFT+ENTER for these formulas, so they are executed as a matrix function.
Again, assuming the Order Number is in E2, try:
=LOOKUP(1,0/FREQUENCY(0,1/(1+(A2:A8=E2)*B2:B8)),C2:C8)
Regards
If the versions are listed in order for each Sales Order numberyou can use LOOKUP like this:
=LOOKUP(2,1/(A$2:A$8=E2),C$2:C$8)
Where E2 contains a specific order number
....or you can use the order number directly
=LOOKUP(2,1/(A$2:A$8="SO#12345"),C$2:C$8)

Spreadsheet aggregation/manipulation

I have a spreadsheet structured like
2005 Alameda total HS graduates 1234
2005 Alameda UC enrollees 112
2006 Alameda total HS graduates 892
2006 Alameda UC enrollees 84
...
2009 Yolo total HS graduates 1300
2009 Yolo UC enrollees 93
and so on for every CA county for several years.
I want to generate a spreadsheet like this:
county 2005 2006 ...
Alameda 11.1% 9%
Alpine 7% 8%
...
Yolo 5.5% 4%
i.e. I want to project the years from rows to columns and have a row for each county, then divide the number of graduates (the data from each odd-numbered row in the original sheet) by the number of UC enrollees (even-row data) for each year, and insert it in the appropriate cell.
This would be easy enough for me to do in Java, but I want to get a feel for what's possible just using excel/Google sheets alone - how might I go about accomplishing this?
Assuming the counties are sorted, and they start in cell B2, enter =B2 in cell F2, and enter the following in F3:
=INDIRECT("B"&COUNTIF(B3:B$9999,"<="&F2)+ROW())
You can change 9999 based on the number of records, but it's fine as-is.
Copy F3 down as many rows as are needed:
You can then calculate percentages using SUMPRODUCT:
=IFERROR(
SUMPRODUCT(($A$2:$A$100=G$1)*
($B$2:$B$100=$F2)*
($C$2:$C$100="UC enrollees")*
$D$2:$D$100
)
/
SUMPRODUCT(($A$2:$A$100=G$1)*
($B$2:$B$100=$F2)*
($C$2:$C$100="total HS graduates")*
$D$2:$D$100
),
"")
The first SUMPRODUCT totals UC enrollees that match the year and county. The second SUMPRODUCT does the same for HS graduates. The results are divided, and IFERROR handles divide-by-zero errors for missing data.
Since your example shows percentages, I assume you want to divide UC enrollees by HS graduates, and not the other way around. Either way, I don't get the same totals as you, so let me know if I misunderstood.
Here is the pivot table way of doing it for comparison.
They are many ways of doing this but I've added column headers and chosen to use this formula to put percentages in even rows of column E and zeroes in odd rows in sheet 1:-
=IF(ISEVEN(ROW()),D3/D2*100,0)
Then I've inserted a pivot table in sheet 2 referring to my data in sheet 1 and set up the fields as shown and it's pretty automatic:-

Want formula to return a number value or blank

I have two columns (A & B) of information. I'm trying to create a third (C) with the answer of B divided by A in the form of a percentage or if 100% a blank or dash (-). Below is an example.
I've tried several different formula combinations like =IF((B38/A38)<100,(B38/A38)," ") I can get the percentage answers okay but have not been able to get the wanted result of a blank or a dash.
**A** **B** **C**
1.99 0.99 49.7%
1.99 1.99
3.99 3.99 -
2.99 1.99 66.6%
Thank you for any help given.
100% displayed as an integer is 1, so you want =IF(B1/A1=1,"-",B1/A1)
You are not getting the desired result for the blank because the statement is always true. replace 100 by 100%-
=IF((B38/A38)<100%,(B38/A38),"")

Resources