+ Reply to Thread
Results 1 to 14 of 14

Dynamically change a cell value based on a range of over values

  1. #1
    Registered User
    Join Date
    07-04-2020
    Location
    San Diego, CA
    MS-Off Ver
    Office 365
    Posts
    6

    Question Dynamically change a cell value based on a range of over values

    Hello everyone, I'm building a pricing tool that should generate a different price level based on 300 ranges of values.

    I'm entering a discreet value in a specific cell reserved for manual data entry.

    Based on the value manually entered in that cell, I want a separate cell to populate with a corresponding value based on which range of values that discreet value falls within.

    If I enter 250,000 manually, the other cell should look up in which of the 300 ranges that value exists, and populate with another value on the same line. I have 300 such lines and the variables could fall in any of these 300 ranges.

    I've tried IF(AND statements and tried to define my value ranges as "=IF(AND(D5>=250000,D5<=300000),IF(AND...), and that works for a single range; but I don't think I can get away with this approach on 300 different range definitions within a single cell.

    How do I solve this?

    Thank you all in advance for your help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,824

    Re: Dynamically change a cell value based on a range of over values

    I think it was just a matter of placing your $ signs. Try this in G6 then you can copy it down and across as far as you need.

    =IF(AND(G$2>=$B6,G$2<=$C6),$D6,0)

  3. #3
    Registered User
    Join Date
    07-04-2020
    Location
    San Diego, CA
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Dynamically change a cell value based on a range of over values

    Thank you for taking the time Gregb11 !!

    Your modification is definitely correct in this narrow definition. However, it doesn't go far enough in what I'm attempting to do.

    I need the spreadsheet to apply the rule across all 300 ranges of values. So whatever the discreet value is entered above in line 2, it will check all 300 of the value ranges, not just the one, and apply the corresponding value in column D.

    I hope this makes sense!

  4. #4
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Dynamically change a cell value based on a range of over values

    Why are you saving to .xls instead of .xlsx?

    Does the sample sheet show what you want? Why are years 5 to 10 out of step order?

    Please explain the logic, not how you think it should be done (which is wrong, by the way - ideally you need some form of lookup).

    =INDEX($D$6:$D$20,MATCH(G$2,$B$6:$B$20,1))

    I just need to understand where you want values to appear and why.
    Last edited by AliGW; 07-05-2020 at 01:28 AM.
    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.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Dynamically change a cell value based on a range of over values

    I think this is it. In G6 copied across and down:

    =IF(INDEX($D$6:$D$20,MATCH(G$2,$B$6:$B$20,1))=$D6,$D6,"")
    Attached Files Attached Files
    Last edited by AliGW; 07-05-2020 at 01:38 AM.

  6. #6
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Dynamically change a cell value based on a range of over values

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  7. #7
    Registered User
    Join Date
    07-04-2020
    Location
    San Diego, CA
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Dynamically change a cell value based on a range of over values

    Hello AIIGW, and thank you for the uncanny insight into my intent for this formula! I was not educated on the INDEX and MTCH functions. I need to take an Excel course - you've clearly mastered it!

  8. #8
    Registered User
    Join Date
    07-04-2020
    Location
    San Diego, CA
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Dynamically change a cell value based on a range of over values

    Hello, I'm still working through adapting the solution to the rest of my spreadsheet and I'm formulating some additional questions. Should I mark this thread as solved now and start a new one? Or should I keep this one open until complete.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Dynamically change a cell value based on a range of over values

    Stay in this thread, please. If I think you need to start a new thread, I'll advise you when you ask your next question.

  10. #10
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,824

    Re: Dynamically change a cell value based on a range of over values

    BTW, I'm not sure why you don't think the formula I gave in Post #2 above won't handle 300 ranges of values. It handles as many as you want to add. It gives the same answer as Ali's, just a different formula (it puts zeros instead of empty, but you could change the end to end in "" instead of 0)

  11. #11
    Registered User
    Join Date
    07-04-2020
    Location
    San Diego, CA
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Dynamically change a cell value based on a range of over values

    Hello Greg, thank you for taking the time - you are correct and your approach could also serve this purpose - I appreciate it!

  12. #12
    Registered User
    Join Date
    07-04-2020
    Location
    San Diego, CA
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Dynamically change a cell value based on a range of over values

    Hello Ali, thank you so much for your expert input - I was able to complete my spreadsheet to satisfaction. I marked the thread as solved.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Dynamically change a cell value based on a range of over values

    Glad to help.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon 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 those who helped.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Dynamically change a cell value based on a range of over values

    Hi, there!

    I received VM asking me to explain the formula, so for transparency, I’ll do that here.

    =IF(INDEX($D$6:$D$20,MATCH(G$2,$B$6:$B$20,1))=$D6,$D6,"")

    Firstly:

    INDEX($D$6:$D$20,

    This tells Excel where to look for the value we wish to return

    =MATCH(G$2,$B$6:$B$20,1)

    This tells Excel to find G2 in the range given in column B - the 1 indicates an approximate match which means it will find the value that is closest to and lower than or equal to G2. It then returns the value from the INDEX column (D) that is on the same row.

    =IF(...=$D6,$D6,"")

    Finally, if the value returned by the INDEX MATCH formula is the same as D6, put the value of D6 into the current cell. If not, leave the cell blank.

    I hope this helps. If you need advice about adapting it, just post again.

+ 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] Dynamically change multiple sheet names based upon a cell's value
    By Murman01 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2018, 12:01 PM
  2. Change tab colours dynamically based on cell values in list
    By Bonnister in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2018, 03:22 PM
  3. [SOLVED] Can a Chart dynamically change it range based on a cells value?
    By Bobbbo in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 09-09-2017, 03:11 PM
  4. Replies: 3
    Last Post: 06-28-2016, 04:24 AM
  5. Replies: 6
    Last Post: 10-28-2011, 04:39 PM
  6. Dynamically Set Range Based on Sheet Values
    By DGA2008 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2011, 11:22 AM
  7. Replies: 1
    Last Post: 01-09-2006, 05:15 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