Results 1 to 8 of 8

Use Match or Lookup to create dynamic cell reference in VBA R1C1 formula

Threaded View

  1. #1
    Registered User
    Join Date
    01-20-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    24

    Use Match or Lookup to create dynamic cell reference in VBA R1C1 formula

    Hey all,

    I have a fairly simple nested IF function judging a couple of ISBLANKs as well as some LEN and RIGHT. The problem is that I'd like to put it in VBA. Can do that easily. Here's the catch: I'd like to make the column references dynamic in case the columns get re-arranged. So if "Title 1" gets moved to column C, I'd like the formula to use column C. Does that make sense? Here's the formula in a regular cell.

    =IF(ISBLANK(A3),"",IF(ISBLANK(C3),IF(LEN(A3)=13,RIGHT(A3,11),A3),IF(LEN(A3)=13,RIGHT(A3,11)&"-"&C3,A3&"-"&C3)))

    The code is easy, but making it so the column can shift is a bit harder. I was trying to include Match("Title 1",$A$1:$Z$1,0) inside, but that doesn't return letters and it gets too complicated for the macro to record.

    Any help?

    Thank you so much. I appreciate the help.
    Last edited by rmunsun1; 02-17-2011 at 10:25 AM. Reason: Solved thanks to DonkeyOte

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