+ Reply to Thread
Results 1 to 8 of 8

Automatically populate name into formula based on what row it's on?

Hybrid View

juicestain09 Automatically populate name... 05-05-2012, 03:43 PM
daddylonglegs Re: Automatically populate... 05-05-2012, 05:19 PM
juicestain09 Re: Automatically populate... 05-05-2012, 05:43 PM
mohd9876 Re: Automatically populate... 05-06-2012, 07:54 AM
juicestain09 Re: Automatically populate... 05-06-2012, 11:16 AM
mohd9876 Re: Automatically populate... 05-06-2012, 12:03 PM
juicestain09 Re: Automatically populate... 05-06-2012, 12:13 PM
mohd9876 Re: Automatically populate... 05-06-2012, 12:18 PM
  1. #1
    Registered User
    Join Date
    05-04-2012
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    11

    Automatically populate name into formula based on what row it's on?

    I would like to use the following formula:
    =SUM(COUNTIF(INDIRECT({"'ABC'!8:8","'ABC'!17:17","'ABC'!26:26","'ABC'!35:35","'ABC'!44:44"}),'CBA'!A5))
    Where ABC is worksheet 1 and CBA is worksheet 2, and the formula is used in cell C5. Currently, the 'CBA'!A5 portion just tells the formula what to look for in the fields listed prior, but it only works for what is in cell A5 (obviously), and I would like to sort the rows based on another column which would change what is in cell A5. I would like it to automatically change what cell it references to when I go down the column. For example, if I was putting the same formula in cell C11, I would like it to pull the info from A11 instead of A5.

    Is there any way to do this? I'm hoping there's just a different way to write that single 'CBA'!A5 portion of the code.

    Thanks

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Automatically populate name into formula based on what row it's on?

    Perhaps I don't understand what you mean but if you drag that formula down the column won't that give you what you're after? 'CBA'!A5 part will change to 'CBA'!A6, 'CBA'!A7 etc. as you drag down.

    Or do you want it to do something else?
    Audere est facere

  3. #3
    Registered User
    Join Date
    05-04-2012
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Automatically populate name into formula based on what row it's on?

    Yes that will do that, but what I'm saying if i then sort the rows by a certain column it will change what is in A5, A6, etc. so the result will change as well. I need the value to stay the same, no matter what row the info is in. Does that make more sense? Perhaps maybe there's someway to change just the number of the of the cell of the portion of the code I'm referring to? Like say it is originally on row 5, in cell A5, then I sort it and it ends up on row 7 (A7), the code will automatically change from looking at A5 to looking at A7. Is this possible?

  4. #4
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Automatically populate name into formula based on what row it's on?

    I think the only way to do this is to change the cell references that you use to absolute instead of relative ($A$5 instead of A5) but this will require you entering the formulas manually as it will not be changed when you copy the formula down. Let me know if you need a code that will replace the cell references in your existing formula from relative to absolute.

  5. #5
    Registered User
    Join Date
    05-04-2012
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Automatically populate name into formula based on what row it's on?

    But won't that still keep $A$5 in the code even if I switch it to another row? I'm looking for it to change to, say, A7 if I switch it from the 5th row to the 7th row. Know what I mean?

  6. #6
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Automatically populate name into formula based on what row it's on?

    it will change if you include the column which has the formula with the sort range try it.
    otherwise could you post a sample workbook with your data and expected results?

  7. #7
    Registered User
    Join Date
    05-04-2012
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    11

    Re: Automatically populate name into formula based on what row it's on?

    how do i make a workbook?

  8. #8
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Automatically populate name into formula based on what row it's on?

    A workbook is the excel file that you are asking questions about !!!!!!!...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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