+ Reply to Thread
Results 1 to 7 of 7

If statement with variable length range

  1. #1
    Registered User
    Join Date
    05-29-2024
    Location
    uk
    MS-Off Ver
    365
    Posts
    3

    If statement with variable length range

    help.xlsx

    So i have a large data set 120k rows its a bill of materials i need to look at options and see if you have all the CAD for them the problme is all the options are different length so i have to change the range every time i thinking there must be a better way to do this. see the attached file

    This is the code i have at the minute

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by SleepyBat; 05-29-2024 at 09:52 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,802

    Re: If statement with variable length range

    Maybe this?

    =IF(F4="Has CAD",IF(COUNTIF(B5:B6,"CAD Not Found")>0,"Some CAD Missing","All CAD available"),IF(COUNTIF(B5:B6,"CAD Not Found")>0,"Some CAD Missing","All Part level CAD available but option is missing"))
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: If statement with variable length range

    Maybe this, in row 3 copied down:

    =LET(A,B4:INDEX(B4:B15,AGGREGATE(15,6,ROW(A4:A15)-ROW(A4)+1/(A4:A15<>A4),1)-1),B,COUNTIF(A,"CAD Not Found"),IF(F3="-","",IF(F3="Has CAD",IF(B,"Some CAD Missing","All CAD available"),IF(B,"Some CAD Missing","All Part level CAD available but option is missing"))))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,166

    Re: If statement with variable length range

    Welcome to the Forum SleepyBat!

    You did not say how you want to determine the range but it looks like you want to consider all of the rows that follow each Level 1 item, until you get to the next Level 1 item.

    Column A is text, and I recommend that it should be numbers. But I didn't change it, so my formula uses text.

    You have to add a fake Level 1 at the end of the list for this to work. This formula is good for up to 200K rows.

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


    See attached.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    05-29-2024
    Location
    uk
    MS-Off Ver
    365
    Posts
    3

    Re: If statement with variable length range

    @6StringJazzer

    That worked thank you.
    Last edited by AliGW; 05-29-2024 at 09:56 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: If statement with variable length range

    It might have been nice if you had even acknowledged the existence of your other two helpers.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,802

    Re: If statement with variable length range

    Yes, would have been polite to do so.

+ 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] How to concatenate a range with variable length?
    By HelenaF in forum Excel General
    Replies: 11
    Last Post: 02-27-2023, 09:47 AM
  2. INDIRECT MAX with criteria (variable range length)
    By Dahlia in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-10-2016, 10:17 AM
  3. [SOLVED] copy range with variable length
    By Coleman34 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2014, 01:07 PM
  4. Conditional formatting of range of variable length
    By tinkerbelle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2009, 08:36 AM
  5. Variable Range Length & .FillDown?
    By Jason Paris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2006, 03:10 AM
  6. Variable series length/range
    By JessK in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-03-2006, 12:10 AM
  7. [SOLVED] RE: Copying RANGE of variable length
    By Jim Thomlinson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2005, 01:05 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