+ Reply to Thread
Results 1 to 15 of 15

How to autofill X amount of columns based on whatever numeric value X is

  1. #1
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    How to autofill X amount of columns based on whatever numeric value X is

    Hi,

    I've been looking for a solution to the following problem since yesterday afternoon and it has me completely stumped.

    I'm looking for a formula or function that will allow me to auto fill "X" amount of columns, based on whatever value "X" is.

    For instance;

    In the context I'm using it, it is for apprenticeship funding so:

    Row 1, Columns 1 through 34 are months i.e. March 2018 through December 2020.

    If Billy's apprenticeship lasts 12 months, starting May 2018, then cells May 2018 through May 2019 (12 months) auto fill with the correct formula.

    Is there any way to do this?

    Any help would be hugely appreciated

    Regards

    James

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.


    To add a file to a post

  3. #3
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Hopefully should be attached now.

    Regards
    Attached Files Attached Files

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Please try at P2 copy till AW4

    =IF($F2="","",IF(($G2<=P$1)*(EDATE($G2,$I2-1)>P$1),$F2*0.8/$I2,IF(EDATE($G2,$I2-1)=P$1,$F2*0.8/$I2+$F2*0.2+$K2,"")))

    I don't know why you add 500 at July T2.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Brilliant, that seems to do the trick.

    See below reasoning for 500;

    500 is a grant awarded to certain apprenticeships.

    I would require 500 adding to the 4th and then last month, based on whether or not a grant is awarded (this is determined in cell j3)

    If the grant is not awarded, then the calculation remains 80% of the total cost per month, until the final month where 20%x the amount of months is calculated (in the example for Simon, the calculation returns 100 each month until the final when it increases to 400)

    Regards

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to autofill X amount of columns based on whatever numeric value X is

    If adding to the 4th month then

    P2

    =IF($F2="","",IF(($G2<=P$1)*(EDATE($G2,$I2-1)>P$1),$F2*0.8/$I2+(EDATE($G2,4)=P$1)*$K2,IF(EDATE($G2,$I2-1)=P$1,$F2*0.8/$I2+$F2*0.2+$K2,"")))

  7. #7
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    Re: How to autofill X amount of columns based on whatever numeric value X is

    It appears to be adding the first 500 to the 5th month, rather than 4th month... see below;

    month.jpg

  8. #8
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Change 4 to 3

    =IF($F2="","",IF(($G2<=P$1)*(EDATE($G2,$I2-1)>P$1),$F2*0.8/$I2+(EDATE($G2,3)=P$1)*$K2,IF(EDATE($G2,$I2-1)=P$1,$F2*0.8/$I2+$F2*0.2+$K2,"")))

  9. #9
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Brilliant.

    Thank you so much for your help!

  10. #10
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Hi,

    Apologies for re-opening an old thread, however;

    Within the same sheet as discussed earlier, I am now required to utilise an end date function.

    Attached is an example of the sheet and the existing formula.

    I'm looking to add into the formula that if a date is entered into column I (end date) whatever that date may be, the calculations stop on the named month.

    As always, all help is much appreciated.

    Regards
    Attached Files Attached Files

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

    Re: How to autofill X amount of columns based on whatever numeric value X is

    There are no end dates in your sample file. Please mock up what you expect to see with one entered.
    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.

  12. #12
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Apologies,

    Please see re-attached.

    Those filled grey are the examples of what I'd require with an end date entered.

    Regards
    Attached Files Attached Files

  13. #13
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Please try at O4
    =IF($G4="","",IF(($H4<=O$1)*(MIN(EDATE($H4,$J4-1),$I4)>=O$1),$G4*0.8/$J4+(EDATE($H4,3)=O$1)*$L4+(EDATE($H4,$J4-1)=O$1)*($G4*0.2+$L4),""))
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    12-14-2018
    Location
    Durham, England
    MS-Off Ver
    MS Office 16
    Posts
    25

    Re: How to autofill X amount of columns based on whatever numeric value X is

    Quote Originally Posted by Bo_Ry View Post
    Please try at O4
    =IF($G4="","",IF(($H4<=O$1)*(MIN(EDATE($H4,$J4-1),$I4)>=O$1),$G4*0.8/$J4+(EDATE($H4,3)=O$1)*$L4+(EDATE($H4,$J4-1)=O$1)*($G4*0.2+$L4),""))
    Hi Bo_Ry,

    The above works but does not remove the final payment at the end of the duration of training.

    As seen in cells AD4 / AD5

  15. #15
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to autofill X amount of columns based on whatever numeric value X is

    I follow result from the file in Post#12 AD4 / AD5 = 1271, if that's wrong, please upload new file with the correct result.

+ 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] statement based autofill row columns with random
    By fintuwin in forum Excel General
    Replies: 3
    Last Post: 02-12-2016, 11:01 AM
  2. [SOLVED] Cascade/Autofill Columns based on last row entry
    By ssss2005 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-28-2015, 07:30 AM
  3. Replies: 1
    Last Post: 10-21-2013, 11:32 AM
  4. Replies: 3
    Last Post: 08-04-2013, 09:40 PM
  5. Autofill to the right for variable amount of columns
    By sideshow1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2013, 05:31 PM
  6. [SOLVED] Autofill based on data in other columns
    By db3712 in forum Excel General
    Replies: 8
    Last Post: 11-07-2012, 03:34 PM
  7. Autofit Columns based on largest amount of characters
    By dagindi in forum Excel General
    Replies: 2
    Last Post: 01-18-2012, 06:28 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