+ Reply to Thread
Results 1 to 2 of 2

Use another cell value to dictate the exact row no. value that is taken

Hybrid View

  1. #1
    Registered User
    Join Date
    06-14-2020
    Location
    Monaco
    MS-Off Ver
    2019
    Posts
    22

    Question Use another cell value to dictate the exact row no. value that is taken

    Hello, as described in the title, I want a value of a cell to dictate the no.row in a column that i want to look to take as value in the calculation
    Example: On the same last filled current row, I want my cell in column B to display a certain value from a row in column A, but which row it would be depends on the on the last filled current row value in cell C, and how much it looks up will be dictated by that same value in C. If C says "0" I use the current last filled value in A and put it in B, if C says another number, I go that number of rows up and take value from column A on that row.
    If cell C in the current row says 0 , I take the lowest most recent value from row A and show it in B, if cell C contains "5" I take 6th row in A, starting from the lowest up.
    Lets suppose we are on row no. 25 currently and for C25=0 > B25=A25, for C25=1 >B25=A24 , for C25=2 >B25=A23, for C25=3 >B25=A22 etc... I am always starting from lowest row so the bigger my C value is, the further up I go on the list of column A to take the value and put it in my current B row.
    We can also start from 1 and not 0, if 0 cannot be used in the calculation, it will not be a big pain, if I have that logic implemented.
    Lets hope I managed to describe what I want. Maybe it is simple but it is hard for me to put it in words and I dont know how to make an example sheet with that... Thanks for the help to the forum once again!

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Use another cell value to dictate the exact row no. value that is taken

    have a look at OFFSET, e.g.

    Formula: copy to clipboard
    B25: 
    =OFFSET(A25,-C25,0)
    this will use A25 as the "anchor" cell and move up (c/o minus) n rows where n is determined by value in C25

    edit: should you need to account for possibility of value in C being > rows available (above) you can implement a MAX, e.g.:
    Formula: copy to clipboard
    B25: 
    =OFFSET(A25,MAX(-ROW(C25)+1,-C25),0)
    Last edited by XLent; 03-22-2023 at 02:56 AM.

+ 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. Search/Find specific word in cell text which will dictate the result
    By Diogokmd in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-01-2023, 10:06 PM
  2. Replies: 3
    Last Post: 02-19-2019, 10:25 AM
  3. [SOLVED] Find exact text in exact cell but on any sheet?
    By nobodyukno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2017, 02:59 PM
  4. Vba dictate what goes into a cell
    By RayBax in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2017, 10:48 AM
  5. Replies: 9
    Last Post: 06-18-2010, 07:14 PM
  6. VBA to print to word and dictate style
    By Rob van Veen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2009, 10:43 AM
  7. Replies: 5
    Last Post: 07-08-2009, 01:12 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