+ Reply to Thread
Results 1 to 2 of 2

IF-ELSE condition : If cell does not contain certain variables, apply a certain formula

  1. #1
    Registered User
    Join Date
    01-13-2021
    Location
    Mumbai
    MS-Off Ver
    MS Office Standard 2010
    Posts
    5

    IF-ELSE condition : If cell does not contain certain variables, apply a certain formula

    Hi,

    I'm trying to separate the "h" and "min" using the space in between with the 'LEFT' and 'MID' formula (eg. 2h 45min)

    In certain cells only the "h" or "min" is present (eg '2h' or '40min'). So I need to create a small excel "IF-ELSE" formula where, if the cell does not contain "h" or "min", it returns me the string present in the cell. I tried the following to separately get the 'h' and 'min' string:

    =IF(SEARCH(" ",LEFT(C2,(FIND(" ",C2,1)-1)),C2))
    =IF(SEARCH(" ",MID(C2,FIND(" ",C2)+1,256)),C2))

    The formula isn't executing and is giving a variable issue. Where am I going wrong?

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: IF-ELSE condition : If cell does not contain certain variables, apply a certain formul

    using SUBSTITUTE to replace "min" with " min", "h" with "h " (with 1 space), then trim to be 1 space remains.

    =TRIM(SUBSTITUTE(SUBSTITUTE(C2,"min"," min"),"h","h "))
    Quang PT

+ 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] Macro to apply IF formula to next set of columns if condition is false
    By Ale84 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2015, 01:50 PM
  2. Replies: 3
    Last Post: 03-24-2015, 07:42 AM
  3. Need to Apply two different condition in single formula to a Timelog Sheet
    By Prashant_Shinde in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 03-24-2015, 06:59 AM
  4. Want to link cell but condition apply
    By HaroonSid in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-21-2014, 11:14 AM
  5. Appropriate formula for retrieving time spent on a project where 2 variables apply
    By Medilinklogistics in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-13-2012, 05:31 AM
  6. Formula to apply to multiple worksheets when a condition is met.
    By RunHard in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-03-2009, 03:06 AM
  7. How to apply more than one IF condition in 1 cell
    By Cesar in forum Excel General
    Replies: 1
    Last Post: 12-18-2005, 08:25 AM

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