Forum Discussion

BNewman's avatar
BNewman
Copper Contributor
Nov 20, 2026

excel formula cell reference

I want to write a formula==sumifs or a lookup--where the criteria range uses a value in another cell. For example, rather than write a sumifs as (sheet!A:A,...etc) I want to use the value in a cell itself. Rather than locate the column and adjust it manually as required, I want the formula to pick up the column from a previous, separate lookup. That separate lookup identifies column AG in my example, and that value is in cell D1. So I want the lookup to pull in values from sheet!AG:AG--but I want to direct the lookup from the cell that has pulled in the AG value (D1) rather than rewriting the formula manually to reflect that. Is this the INDIRECT function? I hope I'm articulating what I want to do, because I would think it should be easy for smart programmers to explain to me. It would save a lot of time and assure more accuracy to be able to do this--to reference the criteria range in a cell from a separate lookup. Thanks, Bill

2 Replies

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    Regarding the complete proposed solution from m_tarler, I would just like to add that I particularly like the INDEX approach, as it avoids the volatility of INDIRECT and OFFSET.

    One additional consideration: if the lookup currently returns a column letter (such as AG), it can also be converted into a column number using COLUMN(INDIRECT(D1&"1")), or the lookup itself could return the column number directly. That would make the INDEX approach even more flexible and efficient for larger workbooks.

    I think INDEX is probably the better long-term solution here.

  • m_tarler's avatar
    m_tarler
    Silver Contributor

    Yes you can use the INDIRECT function for  this

    =INDIRECT("Sheet1!"&D1)

    you can also use INDEX or OFFSET or CHOOSECOL.  It would be easier if the output of D1 was a Column Number (33) instead of the Range ("AG:AG") and then

    =INDEX(A:ZZ,0,D1)

    or

    =OFFSET(A:A,,D1-1)

    or 

    =CHOOSECOL(A:ZZ,D1)