+ Reply to Thread
Results 1 to 10 of 10

COLUMN() not working properly within INDIRECT() formula

  1. #1
    Registered User
    Join Date
    03-08-2013
    Location
    Japan
    MS-Off Ver
    Excel for Mac 2011
    Posts
    19

    COLUMN() not working properly within INDIRECT() formula

    I am running into an issue with a formula working perfectly when I put in the cell reference as text, but not when I am using the COLUMN() formula within it to signify the row I want INDIRECT to point to.

    This is my formula:

    =IFERROR(TRIM(MID(SUBSTITUTE( INDIRECT("$C$"&COLUMN(B1)), " ", REPT(" ",100)),AGGREGATE(14,6,SEARCH(F2,SUBSTITUTE( INDIRECT("$C$"& "2"), " ", REPT(" ",100)),ROW(INDIRECT("1:"&LEN(SUBSTITUTE( INDIRECT("$C$"&COLUMN(B1)), " ", REPT(" ",100)))))),1)-101, 100)),"")

    You can see I have 3 instances of INDIRECT hoping to reference the cell C2. In the first and third spot I can use COLUMN(B1) to get the value of 2 for my indirect formula. (I want to do this because when I slide the formula over to my next column, I want that column to reference C3, hence the columns)

    But when I change the second instance in the formula from INDIRECT("$C$" & "2") to INDIRECT("$C$" & COLUMN(B1)) I do not get the result I am looking for.

    Is this because the columns formula cannot be used inside SEARCH or AGGREGATE? I do not know why simply changing "2" to a formula that results in 2 as an answer doesn't work.

    Can anyone help?

    edited: Attached sample file for reference.
    Attached Files Attached Files
    Last edited by tygrrboi; 09-18-2021 at 12:54 AM.

  2. #2
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: COLUMN() not working properly within INDIRECT() formula

    It's may better if you can attach sample file (include your desired output).

    Regards.

  3. #3
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,408

    Re: COLUMN() not working properly within INDIRECT() formula

    The overall formula does not work, it depends on the data in your worksheet

    Can be simplified to, but the Result is different

    INDIRECT("$C$" & "2") >>>> =INDIRECT("C2") when drag right , The result will be like this C2,C2,C2 ............

    INDIRECT("$C$" & COLUMN(B1)) >>>> =INDIRECT("C"&COLUMN(B$2)) when drag right ,The result will be like this C2,C3,C4 .........

  4. #4
    Registered User
    Join Date
    03-08-2013
    Location
    Japan
    MS-Off Ver
    Excel for Mac 2011
    Posts
    19

    Re: COLUMN() not working properly within INDIRECT() formula

    I have edited the post to include the file. Thank you.

  5. #5
    Registered User
    Join Date
    03-08-2013
    Location
    Japan
    MS-Off Ver
    Excel for Mac 2011
    Posts
    19

    Re: COLUMN() not working properly within INDIRECT() formula

    Quote Originally Posted by wk9128 View Post
    The overall formula does not work, it depends on the data in your worksheet

    Can be simplified to, but the Result is different

    INDIRECT("$C$" & "2") >>>> =INDIRECT("C2") when drag right , The result will be like this C2,C2,C2 ............

    INDIRECT("$C$" & COLUMN(B1)) >>>> =INDIRECT("C"&COLUMN(B$2)) when drag right ,The result will be like this C2,C3,C4 .........
    Exactly. C2, C3, C4... is my goal... but the formula does not work when I change "C2" to "C"&COLUMN(B$2)

  6. #6
    Registered User
    Join Date
    03-08-2013
    Location
    Japan
    MS-Off Ver
    Excel for Mac 2011
    Posts
    19

    Re: COLUMN() not working properly within INDIRECT() formula

    I have broken it down for trouble shooting and have determined the following:

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

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

    work fine. They return the same value so the issue is not SEARCH()

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

    gives me the correct value, but
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    gives me a #NUM! error
    The issue is inside the AGGREGATE() function but I am not sure why.

  7. #7
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: COLUMN() not working properly within INDIRECT() formula

    If you don't want to change overall your formula.
    Just cover COLUMN with SUM.

    =IFERROR(TRIM(MID(SUBSTITUTE( INDIRECT("$C$"&SUM(COLUMN(B1))), " ", REPT(" ",100)),AGGREGATE(14,6,SEARCH(F2,SUBSTITUTE( INDIRECT("$C$"& "2"), " ", REPT(" ",100)),ROW(INDIRECT("1:"&LEN(SUBSTITUTE( INDIRECT("$C$"&SUM(COLUMN(B1)))), " ", REPT(" ",100)))))),1)-101, 100)),"")

    Regards.

  8. #8
    Registered User
    Join Date
    03-08-2013
    Location
    Japan
    MS-Off Ver
    Excel for Mac 2011
    Posts
    19

    Re: COLUMN() not working properly within INDIRECT() formula

    Quote Originally Posted by menem View Post
    If you don't want to change overall your formula.
    Just cover COLUMN with SUM.

    =IFERROR(TRIM(MID(SUBSTITUTE( INDIRECT("$C$"&SUM(COLUMN(B1))), " ", REPT(" ",100)),AGGREGATE(14,6,SEARCH(F2,SUBSTITUTE( INDIRECT("$C$"& "2"), " ", REPT(" ",100)),ROW(INDIRECT("1:"&LEN(SUBSTITUTE( INDIRECT("$C$"&SUM(COLUMN(B1)))), " ", REPT(" ",100)))))),1)-101, 100)),"")

    Regards.
    This works somehow. Thank you so much! If its OK, would you mind explaining to me why SUM() is needed so I can work it out for future formulas?

  9. #9
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: COLUMN() not working properly within INDIRECT() formula

    Don't know exactly.
    But if you select COLUMN(B1) then press F9 it will give you a {2} as result. (Answer as array)
    While SUM(COLUMN(B1)) give you only 2. Maybe it effect to INDIRECT in someway.

    Regards.

  10. #10
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: COLUMN() not working properly within INDIRECT() formula

    It is better to use INDEX formula instead of INDIRECT

    In G2
    Please Login or Register  to view this content.
    IN J2
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

+ 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. Delete Duplicate Rows Based on Column B not working properly?
    By Rabbitstew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2019, 12:26 PM
  2. [SOLVED] VLOOKUP & INDIRECT formula not working properly
    By Barking_Mad in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-28-2013, 07:08 AM
  3. [SOLVED] IF formula not working properly
    By argentraven in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-04-2013, 01:56 PM
  4. Indirect function not working properly
    By zuri125 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-12-2012, 01:40 PM
  5. Help: INDIRECT FORMULA NOT WORKING PROPERLY.
    By Renan in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-06-2012, 07:28 AM
  6. Excel 2007 : using INDIRECT formula properly?
    By jezread in forum Excel General
    Replies: 9
    Last Post: 09-30-2011, 05:21 PM
  7. INDIRECT formula not calculating properly
    By negcx in forum Excel General
    Replies: 1
    Last Post: 01-20-2009, 02:03 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