+ Reply to Thread
Results 1 to 2 of 2

User defined function to add cells in same row

  1. #1
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    User defined function to add cells in same row

    I wish to create two user defined functions to add columns based on value in another cell

    For Col G : addpm(A1)
    For Col J : addsl(A1)



    When A1 =1
    G12=0
    J12=N12

    When A1 =2
    G12=N12
    J12=N12+O12

    When A1 =2
    G12= N12+O12
    J12=N12+O12+P12

    When A1 =3
    G12= N12+O12+P12
    J12=N12+O12+P12+Q12

    and so on...

    Note: The value in A1 will go up to 20. I know how to use the nested IF but I wish to get an easier solution.

    Kindly help with the user defined functions addpm() & addsl() in Macros
    Attached Files Attached Files
    Last edited by melvinkoshy; 06-20-2023 at 06:23 AM.

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

    Re: User defined function to add cells in same row

    Here is the first one, you should be able to figure out the second one .

    formula will be
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It doesn't have to be N12 can be any column , it's the row that is important
    Please Login or Register  to view this content.

+ 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. User defined function returns #Value when argument is Defined Row Name
    By Perik in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2021, 02:42 PM
  2. [SOLVED] Counting red filled cells using a user defined function
    By kersplash in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-17-2018, 09:32 PM
  3. [SOLVED] Usage of standard functions into custom function (or user defined function)
    By tusharb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2016, 12:43 AM
  4. Two user defined cells that alter the value of one of the user defined cells
    By smit.etha in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-16-2014, 09:11 AM
  5. User Defined function getting called for all the formula calculation cells
    By 1man in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-13-2014, 08:36 AM
  6. Obtaining column/row numbers of cells in user defined function
    By GreenInIowa in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-19-2005, 05:05 PM
  7. Replies: 2
    Last Post: 06-02-2005, 12:05 PM

Tags for this Thread

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