+ Reply to Thread
Results 1 to 5 of 5

Need formual help for selecting correct column based upon value in another column

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Lawrenceville
    MS-Off Ver
    Excel 2010
    Posts
    31

    Need formual help for selecting correct column based upon value in another column

    I have an excel worksheet
    columns A - AA contain a lot of different fields.
    Row 1 is my headers
    Row 2 starts my data and I usually have around 55,000 rows of data that I import each month.
    In Cell AH1 I have Sep
    The most important columns are F - Q
    F = Jan Amts
    G = Feb Amts
    H = March Amts
    .....
    Q = Dec Amts

    In Cell AC2 I have this formula +N2
    so when Oct comes I will entere +O2 and copy down.

    Instead I want to enter a formula that identifies the value in AH1 and the pulls the amount from the correct column into AC.

    Hope this makes sense.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Need formual help for selecting correct column based upon value in another column

    Put this formula in AC2:

    =IFERROR(INDEX($F:$Q,ROWS($1:2),MATCH($AH$1,$F$1:$Q$1,0)),"")

    Then copy down.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    04-14-2014
    Location
    Lawrenceville
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Need formual help for selecting correct column based upon value in another column

    thank you so much. the formula worked very well. I knew the index match function and had been trying to use that. I did not know about the Row function, I will study that.

    One question, and you probable cannot help, but I thought I would ask.

    I entered the formula in AB2. copied it down about 10 rows and all worked well.

    I then copied it down to the 52,918 row and my excel locked up. I have tried it twice. Using the formula on the first few rows works fine, but on all rows it locks up excel. The user made one change so this is the final formula.

    =IF($AC2>2, SUM($F2:$Q2),IFERROR(INDEX($F:$Q,ROWS($1:2),MATCH($AH$1,$F$1:$Q$1,0)),""))


    Would this formula use a large amount of memory? Just wondering if you had run into this before.
    Last edited by rde55cae; 10-27-2016 at 01:42 PM.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Need formual help for selecting correct column based upon value in another column

    That's a lot of rows.

    Before giving up on Pete's formula, see if this modification locks up. Also entered in AC2 the ROW($2:$2) part must be the first row in which the formula is entered.

    =IF($AC2>2, SUM($F2:$Q2),IFERROR(INDEX($F:$Q,ROW()-ROW($2:$2)+2,MATCH($AH$1,$F$1:$Q$1,0)),""))
    Dave

  5. #5
    Registered User
    Join Date
    04-14-2014
    Location
    Lawrenceville
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Need formual help for selecting correct column based upon value in another column

    thanks for all your help. I think it was something in the end users excel file. I created a new excel template from a blank workbook and it worked fine. thanks again for all the help.

+ 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. Replies: 2
    Last Post: 04-22-2016, 01:25 PM
  2. [SOLVED] Find Correct Column based on the name of a different sheet
    By HJHamm in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-19-2015, 04:13 PM
  3. Selecting a column based on a cells value
    By gjwood in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-16-2013, 03:08 AM
  4. Correct formula to display a condition based on previous column
    By capnhud in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2011, 01:51 PM
  5. Replies: 1
    Last Post: 08-27-2011, 01:12 PM
  6. Selecting cells based on data in another column
    By seifer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2011, 07:43 AM
  7. Selecting a column range based
    By dems in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-09-2010, 11:47 AM

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