+ Reply to Thread
Results 1 to 9 of 9

Adjusting a formula based on another cell value

  1. #1
    Forum Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    402

    Adjusting a formula based on another cell value

    Is it possible to have portion of a formula change based on the value in another cell?

    For example, the D29 would change based on a value in another cell.

    (D18:D29)

    Lets say, Cell A1 has a value of 12.

    I would want this to change such as:

    (D18:D41)

    Basically (D18:D"29+A1")

    I hope that makes sense lol

    Thanks for any help,
    Nick

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

    Re: Adjusting a formula based on another cell value

    There may be various ways to do this. Knowing a little more about your particular context and why you need the range to be dynamic in this way would help. Can you attach a workbook?
    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 Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    402

    Re: Adjusting a formula based on another cell value

    I don't have a sample workbook yet.

    But to simplify this, I am can have the second part of the formula (D18:D "the value from cell A1"

    Is that possible? Where the value in cell A1 would complete the range.

  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,782

    Re: Adjusting a formula based on another cell value

    You may need to look into the INDIRECT function: https://www.exceltip.com/summing/sum...eferences.html

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Adjusting a formula based on another cell value

    You would use the INDIRECT function to do what you are looking to do.

    Put in a SUM formula, it would look like this:

    =SUM(INDIRECT("D18:D"&A1))

  6. #6
    Forum Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    402

    Re: Adjusting a formula based on another cell value

    63falcondude, I tested that out and looks like it will work.

    What is the best way to add that to:

    =SUMPRODUCT(--(A15=$D$18:$D$29),--(YEAR($B$18:$B$29)=YEAR(S23)))

    My attempt failed lol:

    =SUMPRODUCT(--(INDIRECT(A15="$D$18:$D"&A1),--(YEAR(INDIRECT("$B$18:$B"&A1)=YEAR(S23))))))

  7. #7
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Adjusting a formula based on another cell value

    Try this:

    =SUMPRODUCT(--(A15=INDIRECT("D18:D"&A1)),--(YEAR(INDIRECT("B18:B"&A1))=YEAR(S23)))
    Last edited by 63falcondude; 05-30-2019 at 02:15 PM.

  8. #8
    Forum Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    402

    Re: Adjusting a formula based on another cell value

    Perfect 63falcondude! Thank you!

  9. #9
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Adjusting a formula based on another cell value

    You're welcome. Happy to 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] Formula help - adjusting decimal point display based upon name
    By InvGrp2 in forum Excel General
    Replies: 16
    Last Post: 09-29-2017, 07:18 PM
  2. adjusting a cells formula based on different input in another cell
    By cnak in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-25-2017, 07:16 PM
  3. [SOLVED] Adjusting row height based off last used row
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2015, 05:19 PM
  4. Replies: 1
    Last Post: 08-11-2014, 11:59 AM
  5. Adjusting a formula based on a value of another cell...
    By Finalfrontier1976 in forum Excel General
    Replies: 9
    Last Post: 05-28-2010, 07:47 AM
  6. Adjusting a formula cell range
    By Jamie in forum Excel General
    Replies: 1
    Last Post: 05-26-2006, 12:10 PM
  7. [SOLVED] Adjusting one data set based another
    By Barb Reinhardt in forum Excel - New Users/Basics
    Replies: 18
    Last Post: 09-07-2005, 02:48 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