+ Reply to Thread
Results 1 to 6 of 6

Convert General Format to Date, Nested IF Function, If Yes then highlight row

  1. #1
    Registered User
    Join Date
    10-17-2011
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    6

    Convert General Format to Date, Nested IF Function, If Yes then highlight row

    Hi All,

    Any help with this will be much appreciated. So I have a fairly manual process that I am trying to automate with a Macro. The solution needs to work on spreadsheets with differing numbers of rows but always exactly the same columns. All columns have headings in Row 1 so the data is contained below this and the spreadsheet width is up to AE.

    Step 1
    Column AD2 contains dates that are Formatted by General not Date. This causes me an issue as there is a formula in the next step that will not work unless these values are converted. I have tried highlighting the whole column, selecting Data, Text to Columns then Finish and when I record this into a macro it only works around 50% of the time. Any ideas on how this can be written in VBA?

    Step 2
    Next I need to run the following Formula for all rows where there is data in column A. This will always be a different number of rows and column A is the one of the only rows where there will definitely be data in every cell.

    =IF(COUNTIF(X2:AB2,">0"),"no",IF(AND(AC2>0,AD2=E2),"no","yes"))

    Step 3
    If the formula = yes then I need the whole row to be highlighted yellow

    Any help is much appreciated and if there is any further information I can provide please let me know.

    Thanks

    Woody
    Last edited by woody04; 04-20-2012 at 05:24 PM. Reason: Incorrect formula

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Convert General Format to Date, Nested IF Function, If Yes then highlight row

    hi woody04, can you upload a sample workbook?

  3. #3
    Registered User
    Join Date
    10-17-2011
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Convert General Format to Date, Nested IF Function, If Yes then highlight row

    Sample Workbook.xlsx

    Of course I have attached it with this post. I have included the raw data in tab raw and shown the manual completion in the second tab. I have not filled in all of the cells as they are not needed, however on my real spreadsheet these there is data present in the majority of these cells. Also I was unable to input the dates in column AD as general format so I have input them as text.
    Many thanks
    Last edited by woody04; 04-20-2012 at 05:35 PM.

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Convert General Format to Date, Nested IF Function, If Yes then highlight row

    re date issue, it can be removed either manually by selecting cell with number 1, copy, paste special operation:=multiply. The problem lies in the fact that Excel expects the first number to be month so any number exceeding twelve will result the date to be interpreted as string.

    VB option

    Please Login or Register  to view this content.
    re formula: I suppose there is some mistake in it because I can not get "yes" for manually highlighted rows of your sample file.
    Last edited by watersev; 04-20-2012 at 07:09 PM.

  5. #5
    Registered User
    Join Date
    10-17-2011
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Convert General Format to Date, Nested IF Function, If Yes then highlight row

    Sample Workbook 2.xlsx

    Awesome, thank you the first part worked perfectly.

    I am unsure why the formula didn't work. I have re-uploaded the workbook with the formula on the spreadsheet, second tab.

    Step 2
    Next I need to run the following Formula for all rows where there is data in column A. This will always be a different number of rows and column A is the one of the only rows where there will definitely be data in every cell.

    =IF(COUNTIF(X2:AB2,">0"),"no",IF(AND(AC2>0,AD2=E2),"no","yes"))

    Step 3
    If the formula = yes then I need the whole row to be highlighted yellow



    Once again any help on this second part is greatly appreciated, many thanks.

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Convert General Format to Date, Nested IF Function, If Yes then highlight row

    try this:

    Please Login or Register  to view this content.
    Last edited by watersev; 04-21-2012 at 05:38 AM. Reason: code updated

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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