+ Reply to Thread
Results 1 to 20 of 20

Total Accoustic Sound Level for N Data Points

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Total Accoustic Sound Level for N Data Points

    Im trying to calculate the total sound level of about 500 data points (each point is every 4 columns in my spreadsheet), and I have the following formula to guide me there: SPL-Addition03.gif, where LΣ = Total level and L1, L2, ... Ln = sound pressure level of the separate sources in dBSPL.

    Is there a quick macro or Excel feature that can help me implement this?

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

    Re: Total Accoustic Sound Level for N Data Points

    Is there a quick macro or Excel feature that can help me implement this?
    I'm not aware of a single click solution to this problem already programmed into Excel. The quickest/easiest way I see of doing this looks like this:

    I've almost always found, especially with series sums like this, that the easiest way to put them in Excel is to get the individual elements of the series into a single continguous range. Since your data are kind of spread out, I would first bring the data into a contiguous range, then apply the operations to each element, and finally, sum them all up. My solution might look like this (comma delimited):
    Please Login or Register  to view this content.
    I don't know if that will meet your definition of quick and easy (it often seems to me that "quick and easy" means "take a lot of time and effort trying to derive a single cell array formula that will do all of the above"), but it seems quick and easy to me.
    Last edited by MrShorty; 11-21-2013 at 02:50 PM.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    04-15-2013
    Location
    TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Total Accoustic Sound Level for N Data Points

    Cant I use the following code, and then just change it so that instead of adding columns, I select a specific box and move on until I get to the range of columns that I need...and then just apply those values into my equation. Then once it calculates for the first line, it goes down each row until some max? I know this might be inefficient, but I need a fast solution to just get it to work.

    Please Login or Register  to view this content.
    The only other idea I had to throw around was to select data every 4 columns, for all rows and then input that into a chart. It would make for a lot more data Id have to plot, but it might make operations easier?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Total Accoustic Sound Level for N Data Points

    Cant I use the following code, and then just change it so that instead of adding columns
    Try and see if it gives you what you want, you can always "undo" or reopen without saving
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    04-15-2013
    Location
    TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Total Accoustic Sound Level for N Data Points

    Quote Originally Posted by FDibbins View Post
    Try and see if it gives you what you want, you can always "undo" or reopen without saving
    Well I tried using
    Please Login or Register  to view this content.
    but that threw me a run time error when I tried to run it. Is my notation correct?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Total Accoustic Sound Level for N Data Points

    Hide is not a method, Hidden is a property:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

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

    Re: Total Accoustic Sound Level for N Data Points

    If you want to adapt VBA code to this problem, I don't see anything wrong with that. Perhaps a lot depends on which approach you feel will be easiest. As I noted above, I have found that the easiest way to deal with many operations in a spreadsheet is to group data into contiguous ranges, then operate on those ranges, so my suggestion was based on my opinion of what is easier. Many find coding VBA (or other symbolic programming language) is easier than spreadsheet formulas, and they will, like you are suggesting, use their favorite programming language to perform calculations. In many ways, it is a matter of personal preference and which "language" (treating a spreadsheet as a programming language) you find it easier to program in.

    Which do you find is easier for you: spreadsheet formulas or VBA code?

  8. #8
    Registered User
    Join Date
    04-15-2013
    Location
    TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Total Accoustic Sound Level for N Data Points

    Well after numerous attempts, I cant seem to get the code correct to hide the columns I want. It seems to be haphazard in the first few columns when the macro starts, and then from there it hides the wrong columns.

    Here is my code:
    Please Login or Register  to view this content.
    I have data on column 1469 that I want to skip, then hide the three columns to the left of it, skip one column and keep going back and forth.

    If I can just get the column hiding to work, then I can move on to figuring out that log summation of the data all in sequential order.

  9. #9
    Registered User
    Join Date
    04-15-2013
    Location
    TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Total Accoustic Sound Level for N Data Points

    Quote Originally Posted by MrShorty View Post
    If you want to adapt VBA code to this problem, I don't see anything wrong with that. Perhaps a lot depends on which approach you feel will be easiest. As I noted above, I have found that the easiest way to deal with many operations in a spreadsheet is to group data into contiguous ranges, then operate on those ranges, so my suggestion was based on my opinion of what is easier. Many find coding VBA (or other symbolic programming language) is easier than spreadsheet formulas, and they will, like you are suggesting, use their favorite programming language to perform calculations. In many ways, it is a matter of personal preference and which "language" (treating a spreadsheet as a programming language) you find it easier to program in.

    Which do you find is easier for you: spreadsheet formulas or VBA code?
    That is what Im trying to do: group the data into one long continuous range. Easiest way is to first hide the data that is in between, and then run the mathematical operation on the range.

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

    Re: Total Accoustic Sound Level for N Data Points

    This is not the kind of VBA programming I do, so I'm not very good at it.

    Since the pattern is show every 4th column, it might be easier to hide all 1500 columns, then, start with the first (or last) column you want to show, and step through and show every 4th column from there.

    One caution -- I'm not sure if Excel's worksheet functions automatically ignore hidden cells. You might go to all this work to hide columns, then find that the =sum() function is still including the hidden functions in the summation. I would certainly suggest you test this to see if hiding columns causes them to be ignored by the sum function or not.

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Total Accoustic Sound Level for N Data Points

    =SUM(A1:Z1) will include hidden cells within that range.

    =SUBTOTAL(109, A1:Z1) will NOT include hidden cells within the range.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Total Accoustic Sound Level for N Data Points

    =SUBTOTAL(109, A1:Z1) will NOT include hidden cells within the range
    I do believe it will, JB. It's one of those row/col asymmetries in Excel.

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Total Accoustic Sound Level for N Data Points

    =SUBTOTAL(9, A1:Z1) will include hidden rows, =SUBTOTAL(109, A1:Z1) will not

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Total Accoustic Sound Level for N Data Points

    There's only one row referenced in the formula, FD. Did you try it?

  15. #15
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Total Accoustic Sound Level for N Data Points

    He's right, Ford. Excel inconsistencies rears it's ugly head again.

    The SUBTOTAL(109, Range) will NOT include hidden ROWS within a vertical range, but it WILL include hidden columns across a horizontal range.

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Total Accoustic Sound Level for N Data Points

    i stand corrected, thanks

  17. #17
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Total Accoustic Sound Level for N Data Points

    Couple of functions I have in my personal.xls...
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    04-15-2013
    Location
    TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Total Accoustic Sound Level for N Data Points

    This is a great bit of code. Any chance you have an example that uses it so I can see it in action?

    Also, this all assumes that Ive managed to hide all of the columns in between the dB data in order to analyze just that data sequentially. Any code ideas for doing that? I tried doing it manually yesterday, and it took an hour just to get through about 50 data points - Ive got 500.
    Last edited by Science-Guy; 11-22-2013 at 05:50 PM.

  19. #19
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Total Accoustic Sound Level for N Data Points

    if you have
    80 in A1:A4
    =dbasum(A1:A4)
    will return 86
    =dbaaverage(A!:A4)
    will return 80.

    If you want only visible cells then change lines that look like:
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    04-15-2013
    Location
    TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Total Accoustic Sound Level for N Data Points

    I got together with an in-house programmer from another department and we figured this out. Thanks for the help!

+ 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. [SOLVED] VBA for calculating total quantity in multi level Bill of material
    By redmarko in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-29-2020, 05:45 PM
  2. Total Points
    By saspinall in forum Excel General
    Replies: 4
    Last Post: 11-13-2010, 12:20 PM
  3. Total points
    By 9khonnei in forum Excel General
    Replies: 7
    Last Post: 09-26-2009, 09:14 AM
  4. Replies: 4
    Last Post: 05-30-2008, 10:39 AM
  5. Replies: 1
    Last Post: 05-14-2008, 02:59 PM

Tags for this Thread

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