+ Reply to Thread
Results 1 to 9 of 9

Unable to select the correct formula (IF or VLOOKUP) to get results in column B

  1. #1
    Registered User
    Join Date
    12-16-2019
    Location
    Bucharest
    MS-Off Ver
    Office 2016
    Posts
    4

    Question Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    Hello everyone,

    I've been struggling to find an appropriate formula I can use to autofill or to use IF / VLOOKUP for specific data text based on what data I have in column A.
    I'm not sure if this can be done in excel in anyway, I've been spending a few hours searching for a hint or an idea on google, but I couldn't find anything that I understand.

    To get straight to the point:
    I would like to autofill the B column with one of the following values:
    Breached
    Less than 5 hours
    Less than 1 Day
    More than 1 Day
    5 Days
    More than 5 Days

    For example, if in column A I have "0 Seconds", in column B I would like to have "Breached".
    If in column A I have anything greater than "1 Seconds" until "4 hours 59 Seconds"= "Less than 5 hours"
    If in column A I have anything between "5 hours 0 Minutes" and "23 Hours 59 Minutes"= "Less than 1 Day"
    If in column A I have anything between "24 Hours 1 Minute" and "4 Days 23 Hours 59 Minutes"= "More than 1 Day"
    If in column A I have "5 Days 00 Hours 0 Minutes"= "5 Days"
    If in column A I have anything greater than "5 Days 0 Hours 1 Minute" = "More than 5 Days"

    The issue is, the values from column A are not static, they will change on a daily basis and I cannot transform them into actual Date&Time in excel, because I extract them from a ticketing system and I extract them right in this format "xx Days xx Hours xx Minutes" or "xx Seconds".

    I'm not sure how I can do this with a formula instead of doing it manually every day...
    It's difficult to do it manually since I have around 400-600 entries.
    Does anyone have any idea?
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Larisa89; 12-17-2019 at 06:28 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    Welcome to the forum.

    A picture is practically useless. Read the yellow banner up top about how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    I think you would probably need to use another column, in which you could extract the values for days, hours, minutes etc. and convert them to some numeric value (this column could be hidden), and then use this number to search a lookup table to return the desired result.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    12-16-2019
    Location
    Bucharest
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    Hello AliGW,

    Thanks for the tip!
    I've added the excel file as well.
    Basically there is no formula behind those columns.

  5. #5
    Registered User
    Join Date
    12-16-2019
    Location
    Bucharest
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    Quote Originally Posted by Pete_UK View Post
    I think you would probably need to use another column, in which you could extract the values for days, hours, minutes etc. and convert them to some numeric value (this column could be hidden), and then use this number to search a lookup table to return the desired result.

    Hope this helps.

    Pete
    Hello Pete,

    Thanks for the quick reply!
    I was also thinking that I need to convert the column A into numeric time, but I'm not very sure how that would look like with the actual data I have inserted in column A.
    For example, I don't know how to transform into time the information "2 days 17 Hours 43 Minutes", etc. Especially since the data might differ each day. :-?

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

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    Insert a new column B in the file you attached, and put this formula in B2:

    =IFERROR(LEFT(A2,FIND("Day",A2)-1)*24*60*60,0) + IFERROR(MID(0&A2,FIND("Hour",0&A2)-3,3)*60*60,0) + IFERROR(MID(0&A2,FIND("Min",0&A2)-3,3)*60,0) + IFERROR(MID(0&A2,FIND("Sec",0&A2)-3,3)*1,0)

    and copy this down. It will convert the entries in column A into seconds, and then you can use this to determine the results that you want in column C.

    Hope this helps.

    Pete

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

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    Sorry, I should have given you the rest of it. Put these values in cells G2 to G7 (after inserting that new column B):

    0
    1
    18000
    86400
    432000
    432001

    Then you can use this formula in C2:

    =VLOOKUP(B2,$G$2:$H$7,2)

    Copy this down as required.

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    12-16-2019
    Location
    Bucharest
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    Hello Pete,

    Thanks for the tip!
    I'll try what you've suggested.

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

    Re: Unable to select the correct formula (IF or VLOOKUP) to get results in column B

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    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. Re: VLOOKUP function. results not correct/as execpted
    By Mr.Magoo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-10-2014, 06:17 AM
  2. [SOLVED] Vlookup formula to select and highlight (conditional formatting) multiple results
    By hbomb1927 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-20-2014, 03:27 PM
  3. Replies: 3
    Last Post: 06-04-2014, 08:37 PM
  4. [SOLVED] Simple VLOOKUP not bringing back correct results
    By AL2275 in forum Excel General
    Replies: 6
    Last Post: 04-30-2012, 09:32 AM
  5. Unable to get a correct stacked column chart
    By Norskie39 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-15-2012, 05:31 AM
  6. VLOOKUP not returning correct results
    By Lea724 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-22-2011, 02:38 AM
  7. vlookup: I have to double click each cell to get correct results?
    By gillyd in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2006, 09:10 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