+ Reply to Thread
Results 1 to 11 of 11

Formula to read an specific column based on another cell value

  1. #1
    Registered User
    Join Date
    08-20-2015
    Posts
    21

    Formula to read an specific column based on another cell value

    Hi guys,

    As part of a formula I am building, what I need is when I type an Australian State in a cell, the formula reads the column correspondent to that State. I have attached the spreadsheet as an example.

    I tried a mix of VLOOKUP and HLOOKUP without success...

    Please let me know you expert thoughts

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2015
    Location
    Uvalde, TX
    MS-Off Ver
    2010
    Posts
    720

    Re: Formula to read an specific column based on another cell value

    Hi,

    With a list modification of your C2 cell to just the state abbreviation you can use this INDEX MATCH MATCH formula.

    Please Login or Register  to view this content.
    Attached is a modification of your file showing how it works.

    Hope this makes sense and works for you.

    Cheers
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-20-2015
    Posts
    21

    Re: Formula to read an specific column based on another cell value

    Hi there,

    Thanks for your reply. I guess I over complicated my example.

    What I really need is a formula that, based on the value provided in cell C2, will change the column looked at.

    The whole formula is:

    {=IFERROR(INDEX(Forecast_Data_Entry!A:A,SMALL(IF(Forecast_Data_Entry!$C$3:$C$10000<>"",IF(Forecast_Data_Entry!$A$3:$A$10000>$L$89,ROW(Forecast_Data_Entry!$F$3:$F$10000))),ROWS($L$90:L90))),L89+1)}

    The bold part of the formula is the bit I am missing. I want that section of the formula to provide a result that will look at a different column depending on the input from cell C2. At the moment I need to manually change it from Forecast_Data_Entry!$C$3:$C$10000 to Forecast_Data_Entry!$F$3:$F$10000 manually...

    Does it make sense?

    Apologies for not making it clearer earlier.

    Thank you very much.

    LEORITY
    Last edited by LEORITY; 05-17-2017 at 12:25 AM.

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Formula to read an specific column based on another cell value

    what is your expected result in your example and why
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula to read an specific column based on another cell value

    Agree with Siva. You have shown us what you tried and did not work, but we need to see what you expect
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    08-20-2015
    Posts
    21

    Re: Formula to read an specific column based on another cell value

    I have a database on the same spreadsheet that will be read by this formula. On cell C2 there will be a typed value (in the example there are Australian states, but it can be other things too) and I need the formula to read any column where the typed value is.
    I just need to change the bit that is in bold because the formula works well (apart that I have to manually change the column when things change).
    Hope this made a bit clearer...
    Cheers

  7. #7
    Registered User
    Join Date
    08-20-2015
    Posts
    21

    Re: Formula to read an specific column based on another cell value

    I have just remade the example with the actual formula in it.

    I want to type in cell C2 one of the locations (that will change names and number of locations over time).

    Formula:
    {=IFERROR(INDEX(H:H,SMALL(IF($I$6:$I$10000<>"",IF($H$6:$H$10000>$C$7,ROW($I$6:$I$10000))),ROWS($C$8:C8))),C7+1)}

    At the moment I have to manually change the $I$6:$I$10000 part of the formula. So I just wanted a way to automate it based on what I type on cell C2.

    Thanks
    Attached Files Attached Files

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Formula to read an specific column based on another cell value

    C8=IFERROR(INDEX(H:H,SMALL(INDEX(((INDEX($I$6:$N$10000,,MATCH($C$2,$I$5:$N$5,0))="")+($H$6:$H$10000<C$7))*10^10+ROW($H$6:$H$10000),0),ROWS(B$8:B8))),"")
    Please Login or Register  to view this content.
    Try this and copy towards down

  9. #9
    Registered User
    Join Date
    08-20-2015
    Posts
    21

    Thumbs up Re: Formula to read an specific column based on another cell value

    Hi thanks for this!!

    I only modified a parts of the formula to suit my needs. See below:

    =IFERROR(INDEX(H:H,SMALL(INDEX(((INDEX($I$6:$N$10000,,MATCH($C$2,$I$5:$N$5,0))="")+($H$6:$H$10000<=C$7))*10^10+ROW($H$6:$H$10000),0),ROWS(C$8:C8))),C7+1)

    Can you please explain the indexes on this formula? Also, what does the 10^10 do?

    Thank you so much for the great solution!!!
    Attached Files Attached Files

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Formula to read an specific column based on another cell value

    to avoid shift+ctrl+enter I used Index then
    if the condition not fulfill then 10^10 will give 10000000000, but excel will not have that much of rows, so simply it through an error after pulling the required data

  11. #11
    Registered User
    Join Date
    08-20-2015
    Posts
    21

    Re: Formula to read an specific column based on another cell value

    WOW! That is impressive. Thanks once again!!

+ 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. sort all white fill cell on column I based on cell value specific txt if (true)
    By raijinlee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2017, 01:57 AM
  2. How to countif a specific column based on a cell text value.
    By JamesBlack90 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-24-2015, 07:46 AM
  3. Search for specific cell based off Row/Column and input data into that cell
    By dizzle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2014, 01:53 PM
  4. [SOLVED] Populating column based on specific cell value
    By VKS in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-17-2014, 12:08 PM
  5. Output to a specific cell in another workbook based on a value in a column
    By wojizzle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-19-2012, 04:11 AM
  6. [SOLVED] copying specific certain column data based on cell/column value to another sheet
    By arctic7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2012, 03:38 PM
  7. Find & Replace in all Workbook (Read all Names from Specific Column)
    By dim06 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-15-2012, 09:45 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