+ Reply to Thread
Results 1 to 8 of 8

MATCH function - using COUNT to return a row#

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    83

    MATCH function - using COUNT to return a row#

    Hi Guys & Gals,

    I'm hoping you can help - I spent a good chunk of yesterday afternoon trying to figure this out and I now need some help today, or failing that, therapy tomorrow!! :op

    My problem/question concerns the breaking up of a cell reference using the MATCH command so that it's row & column. The purpose is to use the #of non blank cells to calculate the range, rather than use an arbitrary value like A4:A1000.

    At the moment, I have,
    Please Login or Register  to view this content.
    I would have hoped I could use:
    Please Login or Register  to view this content.
    but this doesn't seem to work. I was also thinking about using the R1C1 format, but all the other formulae in the sheet are in A1 format so I don't want to change the worksheet format and I've been faffing trying to find a way to convert one to the other...


    For the background, I'm trying to create a dropdown list based on another dropdown list. So the first dropdown list would be to select an activity e.g. "Wash Car"; "Cook Dinner"; "Use Computer" and the second list would be to provide a dropdown list of relevant activities e.g. if Wash Car were selected, then in the column to the right, the dropdown list would show, "Hose car"; "Sponge wash"; "hoover inside"; "Shammy Dry". I've ended up using the 'List' option in Data Validation with the following formula, which seems to work ok!
    Please Login or Register  to view this content.
    I would really appreciate if someone could clarify if some formulae can not be split in this way (i.e. break up a range into "A" & 5 , and some can, or whether I'm making a fundamental mistake! I used it for the INDIRECT function, so I'm struggling to see why it's not working for the MATCH function (other than a stupid mistake on my part which is a likely option!)

    Secondly, if there is a better way of achieving my objective, I would also be grateful to see this!

    Thank you for reading!

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: MATCH function - using COUNT to return a row#

    Hi,

    Slightly difficult without seeing an actual workbook, but in general you need a construction like:

    =MATCH(D28,Database!$A4:INDEX(Database!$A:$A,COUNT(Database!$A:$A)+2),0)

    which is preferable to similar constructions involving INDIRECT due to its being non-volatile.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    08-30-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: MATCH function - using COUNT to return a row#

    Sorry,

    Here is a slimmed down version of what I'm trying to achieve...
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-30-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: MATCH function - using COUNT to return a row#

    Thanks XOR LX.

    I've seen quite a few people praise the 'INDIRECT' function.... Could you possibly elaborate on why it is volatile?

    I am still not sure which formulae (like COUNT, MATCH, OFFSET etc.) which allow you to form a cell or range reference using quotes & numbers e.g.
    Please Login or Register  to view this content.
    could be
    Please Login or Register  to view this content.
    In the end I changed the formula set up to:
    Please Login or Register  to view this content.
    Last edited by vba_madness; 05-09-2014 at 05:39 AM. Reason: Used HTML brackets rather than CODE brackets around formulae

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: MATCH function - using COUNT to return a row#

    Did you attempt to adapt the construction with INDEX that I posted to match your situation?

    "Praise" INDIRECT? Of course, it has its uses. But, when constructing these dynamic, offset ranges, given a choice between INDIRECT, OFFSET (which are both volatile) and INDEX, I know which I'd prefer.

    Regards

  6. #6
    Registered User
    Join Date
    08-30-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: MATCH function - using COUNT to return a row#

    XOR LX,
    Thank you, INDEX did the job - thank you! I keep forgetting to use that & tie myself in knots thinking of different ways of doing hte same thing. It will now hopefully stick in my mind for next time!
    As you can see from my previous reply, I changed the way I used OFFSET slightly so as to avoid having to construct it that way.

    I guess that experience will be the way that I find out when something has gone awry when using INDIRECT and OFFSET. I will, where possible use INDEX in place of these - thanks!

    Now to close this thread!

  7. #7
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: MATCH function - using COUNT to return a row#

    Match, Offset and Index functions use numbers, not column headers, so you can't use them to get an A1 type reference.

    I believe this as your formula for the dynamic named range is what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-30-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: MATCH function - using COUNT to return a row#

    Thanks gak67,

    I was trying to avoid the possibility of rows 1-3 being counted in working out how many operations there were in case I wrote in an activity into there which caused an extra count. I'm not sure if I've actually managed to avoid this scenario however!

+ 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. How to: Return next value w/ same # in index match large function?
    By Yoshi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-06-2015, 02:35 AM
  2. INSERT/MATCH Function - can I match and return more than a single result?
    By nickwee in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2014, 06:02 AM
  3. [SOLVED] How to Return the row# of the 2nd Occurrence using MATCH( ) Function?
    By htawfik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-08-2014, 12:10 PM
  4. Replies: 5
    Last Post: 10-26-2012, 02:21 PM
  5. MATCH Function inconsistent in return value
    By Moose8 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-12-2008, 01:06 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