Do you need a way to find the address location (i.e. A1 notation) of a range? This example expands on TRIMRANGE to explore how to get the range's address location.
If you’re wondering how to get the address from the TRIMRANGE result shown in the previous post (link below), then here are two options – the “long” way and the “short” way. ? The “long” way: Because TRIMRANGE returns a range reference, you can get the top-left and bottom-right cells using TAKE. You can then obtain the location using ADDRESS. (CELL could also be used in this scenario). LET will help simplify this greatly. If you’re using a trim reference (.:. | .: | :.) then you don’t need the TRIMRANGE function (e.g. TAKE(B2.:.F6,1,1)): ?? Start with TRIMRANGE ?? TRIMRANGE(B2:F6,3,3) ?? Add TAKE (top-left cell) ?? TAKE(TRIMRANGE(B2:F6,3,3), 1, 1) ?? Add LET ?? LET(tr, TAKE(TRIMRANGE(B2:F6,3,3), 1, 1), tr) ?? Add ADDRESS ?? LET(tr, TAKE(TRIMRANGE(B2:F6,3,3), 1, 1), ADDRESS(ROW(tr), COLUMN(tr), 4)) This pattern can be used to take the bottom-right cell using -1. As shown in the image, you can pass an array to the parameters of TAKE to avoid having to repeat the function. Wrapping this in TEXTJOIN with a colon (:) delimiter will finish it off: ?? =TEXTJOIN(":", FALSE, [insert let formula from above]) ? The “short” way: The Immediate Window in the Visual Basic Editor (VBE) will let you easily access the Address property of a Range object: ?? Open VBE (Alt+F11, or Excel: Developer | Visual Basic) ?? Open the Immediate Window (Ctrl+G, or VBE: View | Immediate Window) ? You can “ask questions” directly in the Immediate Window by placing a question mark (?) in front of your statement. When you are finished with the statement, press Enter: ?? ?Range("B2.:.F6").Address(False, False) This trim reference example lets us use the trim reference directly in the Range object. What if you need an option that doesn’t have a trim reference? ?? Writing TRIMRANGE directly returns an error ?? ?TRIMRANGE(B2:F6,3,2) ?? Accessing the WorksheetFunction class reveals that TRIMRANGE doesn’t exist ?? ?WorksheetFunction.tr ?? Instead, use Evaluate to resolve this string input to a Range object ?? ?Evaluate("TRIMRANGE(B2:F6,3,2)").Address(False, False) I often use these techniques when I need to explore how Excel is handling the Range. ? Let me know in the comments if you found these techniques useful. BizTrix trains on business skills: https://biztrix.us/ Previous Post: https://lnkd.in/ekyD9YKq?