+ Reply to Thread
Results 1 to 18 of 18

Extract Peak Value with Date & Timestamp

  1. #1
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Extract Peak Value with Date & Timestamp

    We have multiple electric meters that provide a KW interval value every 15 minutes along with the timestamp and date. We can get this in a text file and paste into Excel. The software we use to totalize this is no longer supported and we hope to build something in Excel to accomplish this.

    The file we have provides:

    Meter #, Date, Time, Value

    We are needing to find the peak or Max of the Value column and display along with the date and time of that Max value

    Then perform the same task for other meters which could be in the same file. We would then totalize those values providing one usable value.

    Then for a totally separate calcualtion, we would need to be able to find the value for each device based on a date and time that we enter? We would be looking for the value at a certain time of a certain day for both devices so we can totalize those value. this is a separate value from that above. For example we enter 5/20/2020 08:15 we would need the KW value from all of the devices on that particular time.

    I hope all of this makes sense, and is possible? Can anyone lead me in the right direction? I can't attach a sample so hopefully the above is enough?

    Is this even remotely possible?

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Extract Peak Value with Date & Timestamp

    Hi,
    can you please upload a sample file? Please see instructions in the yellow banner at the top of the page.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: Extract Peak Value with Date & Timestamp

    We are needing to find the peak or Max of the Value column and display along with the date and time of that Max value Then perform the same task for other meters which could be in the same file. We would then totalize those values providing one usable value.
    Seems like a combination of MAXIFS() and a lookup function should make short work of this task. =MAXIFS(value column,meter# column,meter#) will find the max for a given meter#
    =MATCH(reference to MAXIFS,value column,0) will give the row # corresponding to a given maximum value -- assuming there are no duplicates in the value column.
    =INDEX(date column,reference to MATCH() function) will return the corresponding date.
    =INDEX(time column,reference to MATCH() function) will return the corresponding time.

    The only complication I foresee is if there could be multiple copies of the same value in the value column. If the maxima will always be unique, this should work.

    Then for a totally separate calcualtion, we would need to be able to find the value for each device based on a date and time that we enter?
    That seems like a simple lookup function. The main difficulty is that your date and time values seem to be separate columns in the current sheet. I would combine them into one date+time column, then use that column for the lookup.

    In source data, assuming date and time are real date/time serial numbers and not text strings, add column =date+time
    enter your date+time lookup value in a single cell, then use a lookup function to find it =INDEX(value column,MATCH(entered data/time,date+time helper column,1)) I would try to sort the list by date/time so I could use the much faster approximate match option for this. You may also need to account for floating point errors in these calculations.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Extract Peak Value with Date & Timestamp

    I'm a newbie here so it wouldn't allow me to post the file earlier. I just found the forum today after exhausting all searches.

  5. #5
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Extract Peak Value with Date & Timestamp

    Maybe it will allow me. Granted this is just a sample data with what we're trying to accomplish.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Extract Peak Value with Date & Timestamp

    Quote Originally Posted by MrShorty View Post
    The only complication I foresee is if there could be multiple copies of the same value in the value column. If the maxima will always be unique, this should work.
    There is a possibility the same max value is duplicated in the value column with consistent electric loads. The date/time really doesn't matter I suppose for the top part of what we need, mostly just the value. We primarily just need the peak.

    The second part would require the date/time as we essentially would query a date/time and want the value returned for both meters and then totalized. I hope all that makes sense.

    The first part is their non-coincidental peak meaning their total energy demand for the entire month. The second part is their peak demand at the same exact date/time as the entire state of Texas which is their coincidental peak.
    Last edited by kfbeal; 05-27-2020 at 12:02 PM.

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: Extract Peak Value with Date & Timestamp

    The date/time really doesn't matter I suppose for the top part of what we need, mostly just the value. We primarily just need the peak.
    A MAXIFS() or a pivot table should easily be able to tell you the maximum value for each meter. Either option is going to work better if the data are stored in a simple, "flat" file where the data for meter 5001 is immediately beneath the 5000 data. In the long run, make sure you are maintaining this database in a good database format.

    Assuming your data are arranged in a good database, I would probably use a pivot table for this. Select the database -> Insert pivot table -> "meter" as row label and "max of KW" as the values.

    I observe that your "dates" are not real Excel dates. It may depend on what exactly you intend to do with these data in the long term, but I could see value in converting your dates (or changing the date format on the meter reading program that generates the data) to something Excel can use as a date.

    The second part would require the date/time as we essentially would query a date/time and want the value returned for both meters and then totalized. I hope all that makes sense.
    With the data in a good database, this might be easiest with a filter rather than a formula. https://www.wikihow.com/Use-AutoFilter-in-MS-Excel With an autofilter set up, you can click on the drop downs, enter the meter #, the date, and the time and get the value. A lookup function will want the meter#, date, and time combined somehow into a unique lookup value that you can then use for a search, or you end up using the DGET() function, which seems to be in disfavor.

    Part of me would want to understand exactly how you are intending to use this spreadsheet in the long term, but it seems that there will be value in making sure to treat this is a database and build it accordingly.

  8. #8
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Extract Peak Value with Date & Timestamp

    It really isn't a database per se, but we get the files monthly based on a query. For some automatic meters, we are able to export the data from an SQL database into a txt or xls file. My thoughts would be we do that monthly based on the billing period data instead of a database. Having a long-standing database would be more ideal though.

    Other meters we physically download the data at the location via a laptop & bring back to the office to translate into usable values. These are just straight txt or xls files as well. So are you saying store the data in a single table with the labels or meter #, date, time, value, etc ? Then query that data?

    I'm green to pivot tables, etc. so I'm going to have to do some research. Thanks for all of your help!

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,826

    Re: Extract Peak Value with Date & Timestamp

    I don't do any real database work, either, so I'm probably not the best to get advice from.

    It appears that you are getting some of the data from another database and then getting some data directly from individual meters. Even as a non-database user, I could see value in someone being tasked with bringing all of the data from these different sources into a single, well maintained database. I guess it depends on what you intend to do with the data in the future, and how valuable this data is. In the information age, data usually has value, but it will have much less value if it is scattered around or difficult to query.

    As far as the immediate question, it appears that you are getting a bunch of data from different sources, and you want to then summarize and analyze that data. It often seems that the easiest way to do that is to combine all of the data into a good database in Excel (assuming you decide to use Excel for the data storage part), then use Excel's built in database tools to query and summarize that data. I have no experience with it, but Power Query/Get and Transform might be the easiest way in Excel to bring the different data sources together into a single data source. https://support.office.com/en-us/art...e-5bfb1a6c536a Power Query may also have some useful tools for analyzing the data beyond what Excel's built in pivot table and filter/query tools offer.

    It all probably depends on exactly how you are using this data. We might need to better understand exactly where the data are all coming from and exactly how you intend to use the data.

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Extract Peak Value with Date & Timestamp

    Hi kfbeal,

    This looks like a Pivot Table answer using both dates and times are what might help. See the attached where I've done both. See if this gets you closer to your answer. If you get these frequently then a newer version of Excel and Power Query might be a better solution. BUT first see if Pivot Tables get you a good answer.

    meter-totalization suggestions.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  11. #11
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Extract Peak Value with Date & Timestamp

    Try the attachment. we try to use LOOKUP to get the value
    Attached Files Attached Files
    Quang PT

  12. #12
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Extract Peak Value with Date & Timestamp

    That may work also, but if we do keep a full database we would be required to query a date range for monthly usage based on meter #. If we create a separate file each month this would work, although what I did wouldn't match what you did for some reason. Here's a test from April. I actually didn't input the meter number values but I'd like to have it where you input the meter number you want and the data appears below based on the meter number entered. For some reason my date won't display as a date. I was able to export the data with a date format instead of just text. I'm not familiar with all these functions so I'm in awe of all the responses.

    Thank you all for your help, it amazes me that there is so much to Excel we know nothing about and others exceed at it.

    I uploaded a new file with kind of what we may need. I apologize for the changes but how things are done changes how we need the query the data.
    Attached Files Attached Files

  13. #13
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Extract Peak Value with Date & Timestamp

    Hi kfbeal,

    You still need to get all your days in a single table before you pivot. Learn more about Pivots and how to filter and group. See the attached with two more examples. Filter the charts and start learning more about Pivots. Yep - Excel has lots of tools in it.

    Time-Of-Use-April-2020 Two Examples.xlsx

  14. #14
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Extract Peak Value with Date & Timestamp

    Ok, I was finally able to get some time to work on this from all of your help. I think I got some of the data part figured out for now just using Excel. Yes MarvinP, I finally got the data into a single table. The other was just for easy illustration side by side. In the file, you'll see I have actually 12 pivot tables on the same dataset for 4 different meters we need to totalize. This includes the KW and the KWH.

    • Within each pivot table, is there a way to display the date of the Peak KW value so we know what date it occurred on like right below Meter and Type?
    • I found out today, we need the 60 minute intervals as well. Is it possible to take an average of the 4 intervals of every hour such as :00, :15, :30 & :45 and display that through the pivot table? I'm assuming that calculation would need to be done through the data table & just displayed in the Pivot Table? Pivot Tables are pretty powerful in displaying data. If so, any easy way of doing that?
    • Is it possible to enter the date for the Previous KWH reading once and it be used across all the pivot tables? The same goes for the Present KWH Reading?
    Attached Files Attached Files
    Last edited by kfbeal; 06-04-2020 at 07:17 PM.

  15. #15
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,556

    Re: Extract Peak Value with Date & Timestamp

    Within each pivot table, is there a way to display the date of the Peak KW value so we know what date it occurred on like right below Meter and Type?
    Assuming that this refers to pivot tables 8:11 then the following proposal may help.
    1. List the meters in H2:H5
    2. Populate I2:I5 using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    3. Populate F2:F16146 using: =IF(AND(C2="KW",COUNTIFS(H$2:H$5,B2,I$2:I$5,D2)),D2,"")
    4. The source of each of the afore mentioned pivot tables is modified to include column F
    5. Peak Date is added to the values field.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  16. #16
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,556

    Re: Extract Peak Value with Date & Timestamp

    I found out today, we need the 60 minute intervals as well. Is it possible to take an average of the 4 intervals of every hour such as :00, :15, :30 & :45 and display that through the pivot table? I'm assuming that calculation would need to be done through the data table & just displayed in the Pivot Table? Pivot Tables are pretty powerful in displaying data. If so, any easy way of doing that?
    This could be done with the existing data as modeled on Sheet1.
    1. Drag Meter and Type into the filters field
    2. Drag Date into the Row field. It should display twice, once as Days and once as Date. Drag Days back into the filters field. Right click on the Dates (may be months) in the pivot table and select group > days and hours.
    3. Drag Values into the values field. Use the value field settings to change from sum to average.
    Let us know if you have any questions.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    05-27-2020
    Location
    Texas
    MS-Off Ver
    Office 365
    Posts
    14

    Re: Extract Peak Value with Date & Timestamp

    If each month new data comes in, how would we accomplish using that data for each month? Replace the data in the excel file? Adjust the pivot table to include the new rows? Would it be best to have this in an Access database with a query for the entire table and then use the Pivot Table to access that query?

  18. #18
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,556

    Re: Extract Peak Value with Date & Timestamp

    Since I don't know anything about querying Access databases and as you are using the 365 version of Excel then I would think about putting the data into a data model.
    Perhaps the tutorial video linked below will help.
    https://www.youtube.com/watch?v=aOQdxhLCuCA
    Let us know if you have any questions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula to extract date from Date timestamp
    By luisperez19 in forum Excel General
    Replies: 1
    Last Post: 12-15-2019, 11:00 PM
  2. Replies: 12
    Last Post: 06-14-2017, 10:35 AM
  3. Extract date from SQL timestamp format
    By shayma in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-10-2015, 06:08 AM
  4. [SOLVED] VBA - Convert Date/Timestamp into American Date and Military Timestamp
    By ryanmorris in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-01-2015, 03:43 PM
  5. Replies: 6
    Last Post: 05-01-2015, 12:02 PM
  6. Replies: 5
    Last Post: 05-18-2013, 11:59 AM
  7. Replies: 1
    Last Post: 03-13-2006, 07:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1