Search code examples
excelexcel-formulaexcel-2003formulas

Concatenating Date and String in excel


enter image description here

In Excel i am using following formula :-

="Select Count(1) Into Count1 From TRB_TPOAR Where tpo_id='" & A2 & "' and eta_id=old_eta_id and date_creation=to_date('" &  B2 & "','dd/mm/yyyy HH24:MI:SS') and UTL1_EDS_ID='DEI037';
    if Count1>0 then
     Update TRB_TPOAR Set Eta_id=new_eta_id Where tpo_id='" & A2 & "' and eta_id=old_eta_id and date_creation=to_date('" & B2 & "','dd/mm/yyyy HH24:MI:SS') and UTL1_EDS_ID='DEI037';
     DBMS_OUTPUT.PUT_LINE('" & A2 & "'  UPDATED'); 
    end if;"

In excel sheet Column B contains datetime information(eg 1/14/2013 12:20:01 PM), But when i apply the formula,it adds some other numeric value.Can anyone help me,what are the changes to make in above formula?


Solution

  • In your case, Excel returns the serila number of the date in referenced cell. To make sure it returns a string dispaying the date in the format you want, use =TEXT(cell, FormatString).
    E.g.: TEXT(C2, "dd/mmm/yy")
    Bonne chance