+ Reply to Thread
Results 1 to 11 of 11

Formula to put number in right place based on input

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Norway
    MS-Off Ver
    Microsoft 365 MSO Version 2205 Windows 11
    Posts
    23

    Formula to put number in right place based on input

    Hi,

    In attached file I have a summary on the first sheet "Sammendrag". In Cell N-BF I want the sum from the changelog to be put in and/if the total on the right "Prodkode".
    I am going to make 50 sheets that all must summary on the first sheet.

    Today I have to check every "EM" and multiply all prodkode "699 - 791".

    You can see what I mean by looking on cell "P9 -R9" in "sammendrag".

    Think this can be done with and IF formula, but it need to check all prodkode and if there is more then one line they needs to be multiplied and put in the correct cell in sheet "sammendrag.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Formula to put number in right place based on input

    You'd use INDIRECT, something like this:
    B9:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And:
    K9:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And then you need to use SUMIFS to get the totals for each code in each sheet.

    INDIRECT is volatile and you would be using 2250 formulae using INDIRECT/SUMIFS, let alone the several hundred "simple" INDIRECT cell references. That could mean processing time is VERY slow.

    With 365, there might be alternative solutions but you will still need INDIRECT … unless you have tailored formulae for each row. That would be tedious to set up but quicker to process.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Formula to put number in right place based on input

    Hi there,

    It's difficult to test this fully, but you could try inserting the following formula in Cell N9 and then copying it across and downwards as required:

    Please Login or Register  to view this content.

    Hope this helps.

    Regards,

    Greg M

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,585

    Re: Formula to put number in right place based on input

    Indirect formula slow down excel. Worksheet event and a macro can be used to apply formulas.
    Macro applies formulas for existing sheets only When any sheet is added or deleted Run Macro. To start with run Macro to apply all formulas in sheet Sammendrag. This is one time.
    Work sheet event is used to to automatically apply formulas for the row when sheet name changed in Column A.
    Macro code:
    Please Login or Register  to view this content.
    Worksheet event code:
    Please Login or Register  to view this content.
    How to use workheet event the code
    Right click on Sheet tab --> view code
    Visual Basic (VB) window opens.
    Paste the code
    Close the VB window.
    Save the file as .xlsm
    Last edited by kvsrinivasamurthy; 01-30-2023 at 09:08 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Formula to put number in right place based on input

    The forum crashed on me when I posted this reply earlier, but fortunately I had saved it to the clipboard:

    You can use this formula in cell N9 of the summary sheet:

    =SUMIFS(INDIRECT("'"&$A9&"'!$N$50:$N$71"),INDIRECT("'"&$A9&"'!$G$50:$G$71"),N$8)

    then copy across as required.

    When you have added the other sheets you will be able to copy this down, as it picks up the sheet name from column A.

    Note that you may need to use semicolons ( ; ) instead of commas ( , ) in the formula, depending on your regional settings.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    12-13-2012
    Location
    Norway
    MS-Off Ver
    Microsoft 365 MSO Version 2205 Windows 11
    Posts
    23

    Re: Formula to put number in right place based on input

    Hi,

    This was perfect! Excactly what I was looking for!

    Thank you!

  7. #7
    Registered User
    Join Date
    12-13-2012
    Location
    Norway
    MS-Off Ver
    Microsoft 365 MSO Version 2205 Windows 11
    Posts
    23

    Re: Formula to put number in right place based on input

    Hi,

    Thank you for your answer! I tried the file but I do not get it to work. Would be really cool to learn macros. And to show this to my colleagues. Could it be because I am using excel version 2211 15831.20252 ?

  8. #8
    Registered User
    Join Date
    12-13-2012
    Location
    Norway
    MS-Off Ver
    Microsoft 365 MSO Version 2205 Windows 11
    Posts
    23

    Re: Formula to put number in right place based on input

    Quote Originally Posted by kvsrinivasamurthy View Post
    Indirect formula slow down excel. Worksheet event and a macro can be used to apply formulas.
    Macro applies formulas for existing sheets only When any sheet is added or deleted Run Macro. To start with run Macro to apply all formulas in sheet Sammendrag. This is one time.
    Work sheet event is used to to automatically apply formulas for the row when sheet name changed in Column A.
    Macro code:
    Please Login or Register  to view this content.
    Worksheet event code:
    Please Login or Register  to view this content.
    How to use workheet event the code
    Right click on Sheet tab --> view code
    Visual Basic (VB) window opens.
    Paste the code
    Close the VB window.
    Save the file as .xlsm
    Hi,

    Thank you for your answer! I tried the file but I do not get it to work. Would be really cool to learn macros. And to show this to my colleagues. Could it be because I am using excel version 2211 15831.20252 ?

  9. #9
    Registered User
    Join Date
    12-13-2012
    Location
    Norway
    MS-Off Ver
    Microsoft 365 MSO Version 2205 Windows 11
    Posts
    23

    Re: Formula to put number in right place based on input

    Quote Originally Posted by Pete_UK View Post
    The forum crashed on me when I posted this reply earlier, but fortunately I had saved it to the clipboard:

    You can use this formula in cell N9 of the summary sheet:

    =SUMIFS(INDIRECT("'"&$A9&"'!$N$50:$N$71"),INDIRECT("'"&$A9&"'!$G$50:$G$71"),N$8)

    then copy across as required.

    When you have added the other sheets you will be able to copy this down, as it picks up the sheet name from column A.

    Note that you may need to use semicolons ( ; ) instead of commas ( , ) in the formula, depending on your regional settings.

    Hope this helps.

    Pete
    Hi,

    This was perfect! Excactly what I was looking for!

    Thank you!

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Formula to put number in right place based on input

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

    Also, 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.

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Formula to put number in right place based on input

    Glad to help.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    You might also like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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: 07-03-2018, 08:51 PM
  2. Data Input Form with number of line items based on user input
    By j_gideon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2013, 02:54 PM
  3. Using the input box to place number into a macro formula
    By davidcailler in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2012, 05:19 PM
  4. Using text box input to lookup number and replace based on user input into new column
    By harl3y412 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2011, 03:15 PM
  5. Use formula in place of row number?
    By tsimon29e in forum Excel General
    Replies: 5
    Last Post: 05-09-2011, 04:33 AM
  6. Create & Place Autoshapes based upon User Input
    By pk2356 in forum Excel General
    Replies: 2
    Last Post: 11-13-2010, 03:23 PM
  7. [SOLVED] need if-then formula-If a number is > /< something, then place a .
    By JDenio in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2005, 05:06 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