+ Reply to Thread
Results 1 to 3 of 3

Error If

  1. #1
    Registered User
    Join Date
    12-09-2014
    Location
    Italy
    MS-Off Ver
    2010
    Posts
    2

    Error If

    Hi everyone,
    i have a problem with this If

    Range("C1").Select
    ActiveCell.FormulaR1C1 = _
    "=IF(RC[-1]=""lun"",CONCATENATE(RC[-2],"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+6)),""AAAA-MM-GG"")),IF(RC[-1]=""MAR"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-1)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+5)),""AAAA-MM-GG"")),IF(RC[-1]=""MER"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-2)), _
    ""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+4)),""AAAA-MM-GG"")),IF(RC[-1]=""GIO"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-3)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+3)),""AAAA-MM-GG"")),IF(RC[-1]=""VEN"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-4)),""AAAA-MM-GG""),"" TO "" _
    ,TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+2)),""AAAA-MM-GG"")),IF(RC[-1]=""SAB"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-5)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+1)),""AAAA-MM-GG"")),IF(RC[-1]=""DOM"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-6)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2] _
    ,MONTH(RC[-2]),DAY(RC[-2]+0)),""AAAA-MM-GG"")))))))))"
    Range("C2").Select



    what is the issue?

    please help me!

    thank you
    L

  2. #2
    Valued Forum Contributor
    Join Date
    08-04-2011
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    346

    Re: Error If

    my guess is you tried to a formula much longer than the max of 255 characters

  3. #3
    Registered User
    Join Date
    12-09-2014
    Location
    Italy
    MS-Off Ver
    2010
    Posts
    2

    Re: Error If

    i write it down again:
    ActiveCell.FormulaR1C1 = _
    "=IF(RC[-1]=""LUN"",CONCATENATE(RC[-2],"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+6)),""AAAA-MM-GG""))," _
    IF(RC[-1]=""MAR"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-1)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+5)),""AAAA-MM-GG"")), _
    IF(RC[-1]=""MER"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-2)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+4)),""AAAA-MM-GG"")), _
    IF(RC[-1]=""GIO"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-3)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+3)),""AAAA-MM-GG"")), _
    IF(RC[-1]=""VEN"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-4)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+2)),""AAAA-MM-GG"")), _
    IF(RC[-1]=""SAB"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-5)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+1)),""AAAA-MM-GG"")), _
    IF(RC[-1]=""DOM"",CONCATENATE(TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]-6)),""AAAA-MM-GG""),"" TO "",TEXT(DATE(YEAR(RC[-2]),MONTH(RC[-2]),DAY(RC[-2]+0)),""AAAA-MM-GG"")))))))))"


    but it doesn't work!

+ 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] Run-tim error -2147467259(80004005): Automation error Unspecidied error
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2014, 12:12 PM
  2. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  3. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  4. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  5. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 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