+ Reply to Thread
Results 1 to 5 of 5

Returning A Number Against Specific Text

  1. #1
    Registered User
    Join Date
    03-20-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    48

    Returning A Number Against Specific Text

    apologies for the thread title, I'll hopefully explain a little better here.

    I've got four possible entries in column E that relate to the types of 'time off' my staff can have (Weekday Full, Weekday Half, Friday Full and Friday Half). I want to enable it so that when I select one of those 4 drop down options that it returns a number in column F that equals the amount of time off in hours. The breakdown for what I want to appear in relation to each option is here:

    Weekday Full - 7.5
    Weekday Half - 4
    Friday Full - 7
    Friday Half - 3.5

    I would usually just forget about the description and list the hours but I need to simplify it for new starters to understand.

    I can get it working for one entry using =IF(ISERROR(SEARCH("Weekday Full",E2)),2,7.5) but I need to get the formula looking for the other 3 options and subsequent number values, any ideas

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Returning A Number Against Specific Text

    Instead of trying to smoosh all the possible outputs in a single formula, instead you could simplify it by placing the possible entries in short table.

    Imagine Sheet2 A1: Time Off, B1: Time, A2: Weekday Full, B2: 4, etc.

    Now back in your thing thing:

    =VLOOKUP(E2,Sheet2!$A$2:$B$5,2,0)
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Returning A Number Against Specific Text

    Try

    =IF(LEFT(E2,3)="Fri",3.5,4)+(RIGHT(E2,4)="Full")*3.5

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Returning A Number Against Specific Text

    With table created in columns G2:H5 and formula in F2

    =LOOKUP(2^15,SEARCH(G2,$G$2:$G$5),$H$2:$H$5)

    Row\Col
    E
    F
    G
    H
    1
    Table
    2
    Weekday Full
    7.5
    Weekday Full
    7.5
    3
    Weekday Half
    4
    Weekday Half
    4
    4
    Friday Full
    7
    Friday Full
    7
    5
    Friday Half
    3.5
    Friday Half
    3.5
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    03-20-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Returning A Number Against Specific Text

    both of those work well, I actually used a VLOOKUP for something similar the other day but it completely didn't occur to me to do it that way.

    Thanks both, rep added

+ 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] Searching for a specific value on another sheet and returning the row number.
    By Ataraxicatom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-24-2012, 07:47 PM
  2. Replies: 2
    Last Post: 11-04-2010, 03:15 PM
  3. Replies: 6
    Last Post: 07-15-2009, 07:44 AM
  4. returning Specific Text
    By USChad in forum Excel General
    Replies: 1
    Last Post: 02-28-2008, 02:07 AM
  5. returning specific text only
    By Jane in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-21-2006, 04:45 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