I need to average data (3rd column) corresponding to a specific latitude and longitude(1st and 2nd columns). The results are then outputted to columns 4,5,6.
Sample data and manual analysis is posted bellow. I think I need Index, Iferror or Vlookup. Most of the other questions dealing with this kind of work only typically consider 1 variable, not two.
Latitude Longitude Data UniqueLat UniqueLong Average of data
24.4000 -82.5000 13.1 24.4000 -82.5000 13.15
24.4000 -82.5000 13.2 24.4000 -82.4000 15.25
24.4000 -82.4000 17.8 24.5000 -82.4000 13.4
24.4000 -82.4000 12.7 24.5000 -82.1000 14.56
24.5000 -82.4000 13.4 24.6000 -82.0000 18
24.5000 -82.1000 16
24.5000 -82.1000 15.1
24.5000 -82.1000 13.3
24.5000 -82.1000 15.1
24.5000 -82.1000 13.3
24.6000 -82.0000 15.6
24.6000 -82.0000 20.4
I have a second problem related to this original question;
I need to compare my list of latitude/longitude (columns 4 and 5) with the values outputted from the Pivot table containing the latitude/longitude data (columns 1 and 2) and its associated data (column 3). This associated data I need to ascribe to the relevant latitude and longitude in column 6.
I have tried to use the index functionality etc but have had little luck.
Let me know if you can help at all with this second part.
DatabaseLat DatabaseLon Data Lat Lon CopiedData
31.2 -87.9 5 30.5 -87.1 3
31.9 -88.3 6 31.9 -88.4 10
31.9 -88.4 10 54 -87.1
31.1 -87.2 2 31.2 -87.9 5
30.5 -87.1 3
Just use a pivot table:
Select all the data (including headers) in columns Latitude, Longitude, and Data.
Choose Insert > PivotTable.
Drag Latitude and Longitude into the Row Labels section.
Choose PivotTable Tools > Design > Report Layout > Show in Tabular Form and Repeat All Item Levels. Also choose to turn off Grand Totals and Subtotals.
Drag the Data column into the Values section.
Hit the drop-down for Data and change the Value Field Settings... to average.
All said and told, the results should like this:
For the first part I would use an averageifs formula.
For the second part if you are guaranteed that the list you are looking up is unique (I think it is from what you said) you could just use a sumifs to then find the value next to that lat and long.
Related
I have a dataset with the following problem.
Sometimes, a temperature sensor would return duplicate readings at the exact same minute, where sometimes 1 of 2 of the duplicates is "reasonable" and the other is slightly off.
For example:
TEMP TIME
1 24.5 4/1/18 2:00
2 24.7 4/1/18 2:00
3 24.6 4/1/18 2:05
4 28.3 4/1/18 2:05
5 24.3 4/1/18 2:10
6 24.5 4/1/18 2:10
7 26.5 4/1/18 2:15
8 24.4 4/1/18 2:15
9 24.7 4/1/18 2:20
10 22.0 4/1/18 2:20
Line 5, 7 & 10 are readings that are to be removed as they are too high or low (doesn't make sense that within 5 minutes it will rise and drop more than a degree in a relatively stable environment).
The goal at the end with this dataset is to "average" the similar values (such as in line 1 & 2) and just remove the lines that are too extreme (such as line 5 & 7) from the dataset entirely.
Currently my idea to formulate this is to look at a previously obtained row, and if one of the 2 duplicates is +/- 0.5 degree, to mark in a 3rd column with TRUE so I can filter out all the TRUE values in the end. I'm not sure how to communicate within the if statement that I'm looking for a + OR - 0.5 of a previous number however. Does anyone know?
Here is a google sheet example that does what you want:
https://docs.google.com/spreadsheets/d/1Va9RjSeulOfVTd-0b4EM4azbUkYUb22jXNc_EcafUO8/edit?usp=sharing
What I did:
Calculate a column of a 3-item running average of the data using "=AVERAGE(B3:B1)"
Filter the list using "=IF(ABS(B2-C2) < 1, B2, )"
Calculate the average of the filtered list
The use of Absolute Value is what provides "+ OR -" that you were looking for. It is saying if the distance between two numbers is too much, then don't include the term.
So, A Simple Solution came to my mind. Follow the Following steps given below:
Convert Data to Table
Add a 4th column at the last
Enter the formula "Current Value - Previous Value"
Filter the Column with high difference values
Delete those rows of filtered data and you'll be left with Normal Values
Here's the ref. Image
Or If you want to consider the Same time difference only then do the following:
Convert your data to Table
Add 4th column at the end of table
Writhe the Following Formula to 4th Column
IF(Current_Time = Previous_Time, Current_Temp-Previous_Temp,"")
Filter and Delete the Data with high Difference
See the following Image:
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):
I have big amount of data (60k rows) in Excel that is similar to this:
Temperature Humidity Date
20.1 68 22-dec-14
20.3 67 22-dec-14
20.4 65 22-dec-14
20.0 64 23-dec-14
20.5 64 23-dec-14
20.9 65 24-dec-14
21.4 64 24-dec-14
23.4 64 25-dec-14
23.8 65 25-dec-14
23.9 64 25-dec-14
18.4 64 25-dec-14
I created new columns outside this table that contains the individual dates and I want to extract the MAX, MIN and possibly the AVERAGE of that date
DATE MIN MAX AVG
22/Dez/14
23/Dez/14
24/Dez/14
25/Dez/14
I tried but I can't seem to find a way for Excel to work for me. Could you help me?
I suggest you try a PivotTable:
Suppose column A contains the dates, and column B the values. I've allowed 6 rows in each; extend as necessary.
Consider a sample date in $D$1. The formulas you need are:
MIN: =MIN(IF(D1=A1:A6,B1:B6,MAX(B1:B6))). (You need to enter this as an array formula).
MAX: =MAX(IF(D1=A1:A6,B1:B6,MIN(B1:B6))). (You need to enter this as an array formula).
Use AVERAGEIF out of the box.
Remember that you need to press Ctrl + Shift + Return to enter an array formula. Then it's a simple case of copying that formula downwards.
They return the minimum or maximum value of the entire sample if a given date is not present in the set, which might not be desirable. You could adjust this behaviour with a containing IF.
You can take care of the pseudo-MIN/MAX with the AGGREGATE¹ function using the 14 (LARGE) and 15 (SMALL) sub-functions together with the 6 (ignore errors) option and the AVERAGEIF function can take care of the rest.
The standard formulas in F2:H2 are,
=AGGREGATE(15, 6, ($A$2:$A$60000)/($C$2:$C$60000=$E2), 1)
=AGGREGATE(14, 6, ($A$2:$A$60000)/($C$2:$C$60000=$E2), 1)
=AVERAGEIF($C$2:$C$60000, $E2, $A$2:$A$60000)
Fill down as necessary. An advantage of this method is that you can get the second, third, etc smallest or largest simply by raising the 1 (k ordinal) number at the right end of the AGGREGATE formula.
¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.
I am looking for a formula that will return the earliest date from a column, based on the contents of values in other cells. (Actually I want a Min and Max date, but am assuming the Max will be identical to any Min solution )I know I can return the date I want just by using MIN and specifying the range of cells I want, but I ideally want the formula to be dynamic. I have looked around and believe I possibly need to use a combination of index and match, but cant find any examples that use Min and Max. I have considered using dynamic named ranges to define my task groups, but that would mean having to define a static number of task groups, and there could be many task groups.
The sheet below shos some sample date on the left of the workbook, with the summary data on the right. The "hidden worker column" was an idea I had that I though might make the solution easier. So I want the summary data on the right to use either column A, or column B if its easier, to display the min and max dates based on the section number in column F - Is this possible without VBA?
#mthierer's link is good. If you wanted to remove the need to add a "helper column", you could try (data in A1:C10; summary table in E1:G2):
{=MIN(IF(ROUNDDOWN($A$1:$A$10, 0)=$E1, $B$1:$B$10))} (or {=MAX(...)} with $C$1:$C$10)
Note that you have to enter the formula as an array formula with CtrlShiftEnter.
Data (A1:C10):
1 23 57
1.1 42 91
1.2 35 100
1.3 39 80
1.4 28 51
1.5 30 96
2 33 52
2.1 11 73
2.2 48 80
2.3 16 59
Summary Results (E1:G2):
1 23 100
2 11 80
I have a list of 12 cars and need to calculate MPG. I have the miles driven and fuel consumed, so MPG = miles / gallons of fuel is easy enough to program.
Then in the fourth column I want a "label" for the best and worst MPG and all others should just be blank. Here is my formula:
=IF(C1=MAX($C$1:$C$12),"MAX",IF(C1=MIN($C$1:$C$12),"MIN"," "))
Simple enough. A snippet of my data follows.
Miles Gallons
Driven Fuel MPG
1,145 101.936 11.2 MIN
1,277 91.226 14.0
4,561 376.270 12.1
3,655 236.647 15.4
2,598 204.620 12.7
2,948 222.591 13.2
2,384 153.914 15.5
1,808 127.940 14.1
3,034 168.387 18.0
3,763 234.053 16.1
3,237 196.615 16.5
1,530 72.812 21.0 MAX
Next Month
2,515 191.196 13.2
1,908 111.129 17.2
1,589 112.410 14.1
2,223 147.278 15.1
2,221 145.936 15.2
#N/A 142.165 #N/A
1,928 177.609 10.9
1,150 92.072 12.5
#N/A 67.651 #N/A
79 2.849 27.7
407 22.241 18.3
10,537 94.960 111.0
Obviously car 12 has bad data, but that's not my concern right now. What is giving me trouble is the #N/A values for cars 6 and 9. My handy dandy little formula
=IF(C1=MAX($C$1:$C$12),"MAX",IF(C1=MIN($C$1:$C$12),"MIN"," "))
returns #N/A for each vehicle. I have tried to use
If(NOT(ISNA(C1)),IF(C1=MAX($C$1:$C$12),"MAX",IF(C1=MIN($C$1:$C$12),"MIN"," ")),"#N/A")
and
If(ISERROR(C1),"#N/A" ,IF(C1=MAX($C$1:$C$12),"MAX",IF(C1=MIN($C$1:$C$12),"MIN"," ")))
with the same results.
Can my original equation be reworked to compensate for #N/A?
For Excel 2010 or later:
=IFERROR(LOOKUP(2,1/(C1=AGGREGATE({14,15},6,$C$1:$C$12,1)),{"MAX","MIN"}),"")
You may try using array formula
=IF(MAX(IF(ISERROR($C$17:$C$28), 10^-15, $C$17:$C$28))=C17,"MAX","")
This should give you what you want for Office 2010+:
=IFERROR(IF(C17=MIN(IF(ISNUMBER($C$17:$C$28),$C$17:$C$28)),"MIN",IF($C17=MAX(IF(ISNUMBER($C$17:$C$28),$C$17:$C$28)),"MAX",NA())),"")
If you're using Office 2007 or below, you want
=IF(ISERROR(IF(C17=MIN(IF(ISNUMBER($C$17:$C$28),$C$17:$C$28)),"MIN",IF($C17=MAX(IF(ISNUMBER($C$17:$C$28),$C$17:$C$28)),"MAX",NA()))),"",IF(C17=MIN(IF(ISNUMBER($C$17:$C$28),$C$17:$C$28)),"MIN",IF($C17=MAX(IF(ISNUMBER($C$17:$C$28),$C$17:$C$28)),"MAX",NA())))
It's an array formula so you'll have to enter it with Ctrl + Shift + Enter