+ Reply to Thread
Results 1 to 11 of 11

If Then Formula For Headers?

  1. #1
    Registered User
    Join Date
    08-14-2014
    Location
    Carolina
    MS-Off Ver
    2013
    Posts
    17

    If Then Formula For Headers?

    I posted a copy of the file I am trying to complete. I want the orange column on my sheet to display the stage number ( the header) when data is entered into one of the stages cells. The problem is that the data is not consistent, and some of the data will be a date, and some of it just says "comp". Is there a formula to say that if something is entered into one of these stage columns, then the orange column will output the stage number where the data was written?Help.xlsx

  2. #2
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: If Then Formula For Headers?

    Do you the header stage name based on the last entry? So based on your attached 3 samples the result will be as follows:

    Row1 - Stage 19
    Row2 - Stage 17
    Row3 - Stage 17

    If this is not correct can you give me the expected results from your sample
    Excel Guru in the making

    <----------If the question has been answered to your satisfication please click the Add Repuation star to the left

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

    Re: If Then Formula For Headers?

    Do you mean if a date is entered into any of the columns A to V you want that column heading to appear in column W, but anything else (like "comp") should be ignored?

    If so, put this formula in W2:

    =IFERROR(INDEX(A$1:V$1,MATCH(9E+99,A2:V2)),"")

    then copy down. You may need to widen the column to see the full heading.

    Hope this helps.

    Pete

  4. #4
    Valued Forum Contributor TheCman81's Avatar
    Join Date
    11-06-2012
    Location
    Edinburgh, UK
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    346

    Re: If Then Formula For Headers?

    CAn you try this

    =LOOKUP(2,1/(A2:V2<>0),$A$1:$V$1)

  5. #5
    Registered User
    Join Date
    08-14-2014
    Location
    Carolina
    MS-Off Ver
    2013
    Posts
    17

    Re: If Then Formula For Headers?

    Yes this is what I mean

  6. #6
    Registered User
    Join Date
    08-14-2014
    Location
    Carolina
    MS-Off Ver
    2013
    Posts
    17

    Re: If Then Formula For Headers?

    This is really close, but I actually need it to include "comp" as this file is very old ( it is much larger than what I showed) and there are many missing dates that only show "comp" basically if there is anything in these cells then I need it to display what stage it is on.

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

    Re: If Then Formula For Headers?

    In your example file "comp" appeared many times on the same row. In this case, which column would you like the heading for?

    Pete

  8. #8
    Registered User
    Join Date
    08-14-2014
    Location
    Carolina
    MS-Off Ver
    2013
    Posts
    17

    Re: If Then Formula For Headers?

    The most recent stage. So if comp is in stage 17 18 and 19 then I want it to display 19 so I can see where the project currently stands.

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

    Re: If Then Formula For Headers?

    Put this in W2:

    =IFERROR(MATCH(9E+99,A2:V2),IFERROR(MATCH("comp",A2:V2),""))

    it will report the column number, which seems to be what you want from your last post. If there is a date on the row it will report this, if not it will report the last "comp" on the row, or nothing.

    Is this what you want?

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    08-14-2014
    Location
    Carolina
    MS-Off Ver
    2013
    Posts
    17

    Re: If Then Formula For Headers?

    I actually need it to report if the text is "comp" (or even just any text) as well. I have tried messing with your formula but I can't figure out what the parameter is for unlimited text like how the 9E+99 is for all numeric values. I have also been looking at this but of VBA to see if this is what I need to allow any text in the cell to display the stage the project is on.

    Please Login or Register  to view this content.

    Here is a sample of how I want it to work Help.xlsx. I realize that my first post might not have been really clear. This has been a jumbled mess that I have been working on for way to long, I really appreciate all your help!

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

    Re: If Then Formula For Headers?

    I think this will give you what you want:

    =MAX(IFERROR(MATCH(9E+99,A2:V2),0),IFERROR(MATCH("zzzzzz",A2:V2),0))

    Put it in W2 then copy down.

    If the cells are completely empty you will get zero, otherwise it will give you the column number of the last filled cell.

    Hope this helps.

    Pete

+ 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. [SOLVED] How to Copy a filter data with headers, excluding the headers?
    By Elomaldo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-16-2014, 03:35 PM
  2. Replies: 4
    Last Post: 02-08-2014, 02:31 PM
  3. Formula bar covering column headers
    By Hanr3 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 01-21-2014, 09:30 AM
  4. Replies: 2
    Last Post: 05-09-2012, 01:30 PM
  5. Replies: 3
    Last Post: 09-30-2010, 12:30 PM

Tags for this Thread

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