+ Reply to Thread
Results 1 to 18 of 18

Median price for a table with price ranges and inventory

  1. #1
    Registered User
    Join Date
    04-05-2024
    Location
    bucharest
    MS-Off Ver
    365mso version 2208
    Posts
    5

    Median price for a table with price ranges and inventory

    Hi dears,

    I have a chart with data that contains in a column price ranges and in a second column inventory for those price ranges, as in example below:

    column a: 19,99 29,99 39,99
    column b: 1, 4, 3

    So basically for 19,99 price range I have only 1 product, for 29,99 I have 4 products, and for 39,99 I have 3 products.

    I want to calculate the median price range, according to the inventory.

    Is there a formula that can work? I searched all over internet, it only show the median but not according to the stock.

    Thank you!
    Attached Files Attached Files
    Last edited by infonerd; 04-05-2024 at 02:31 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Maybe try this:

    =MEDIAN(DROP(REDUCE(0,A2:A4,LAMBDA(x,y,VSTACK(x,EXPAND(y,MAX(OFFSET(y,,1),1),,y)))),1))
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-05-2024
    Location
    bucharest
    MS-Off Ver
    365mso version 2208
    Posts
    5

    Re: Median price for a table with price ranges and inventory

    I editted. Sorry and thank you!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  6. #6
    Registered User
    Join Date
    04-05-2024
    Location
    bucharest
    MS-Off Ver
    365mso version 2208
    Posts
    5

    Re: Median price for a table with price ranges and inventory

    Thank you so much!

    Sorry to bother further more, and in this new attachment format? is it possible? :D

    Thanks a lot!
    Attached Files Attached Files

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Why didn't you provide this layout right at the start???

  8. #8
    Registered User
    Join Date
    04-05-2024
    Location
    bucharest
    MS-Off Ver
    365mso version 2208
    Posts
    5

    Re: Median price for a table with price ranges and inventory

    I didn't wanted to kill too much time for the helping person and believed that I will adapt a formula to it but it seems didn't worked ((

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Lesson learned, then, I hope!!!

    In X2 copied down:

    =LET(a,VSTACK(FILTER($B$1:$U$1,B2:U2<>""),FILTER(B2:U2,B2:U2<>"")),MEDIAN(DROP(REDUCE(0,INDEX(a,1),LAMBDA(x,y,VSTACK(x,EXPAND(y,MAX(INDEX(a,2),1),,y)))),1)))
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-05-2024
    Location
    bucharest
    MS-Off Ver
    365mso version 2208
    Posts
    5

    Re: Median price for a table with price ranges and inventory

    OMG you are amazing!!!!!! thank you so much!!!!!

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  12. #12
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Median price for a table with price ranges and inventory

    Here is a solution with a shorter formula:

    Please try in X2 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    I don't think either formula (mine or Hans') is actually working correctly.

    I am looking at this, but at the moment have no solution.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Forget that - I believe that Hans' formula is working. Mine is not!

  15. #15
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Median price for a table with price ranges and inventory

    My formula of Post #12 is indeed working well.

    I have also corrected Ali's formula.
    Please try in X2 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This one also works well.
    Attached Files Attached Files

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    Thanks, but there was no need, since yours is shorter.

  17. #17
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Median price for a table with price ranges and inventory

    But my formula messes with the Offset function and row numbers.
    Your formula doesn't do that.

    It can be educational for members to demonstrate both approaches working well.

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,412

    Re: Median price for a table with price ranges and inventory

    That's true.

+ 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. Replies: 2
    Last Post: 12-05-2020, 05:29 AM
  2. Replies: 4
    Last Post: 01-20-2018, 01:49 PM
  3. Price Per Unit in a Table for a Fixed Incremental Price Discount
    By natkoy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-22-2016, 03:51 AM
  4. Median for price on certain date
    By realica in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-02-2015, 07:54 PM
  5. Replies: 3
    Last Post: 01-03-2013, 12:32 AM
  6. [SOLVED] Need remaining average inventory price after partial inventory is sold
    By Akano in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-04-2012, 04:12 AM
  7. Replies: 4
    Last Post: 08-15-2012, 09:49 AM

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