+ Reply to Thread
Results 1 to 4 of 4

Text returning a numerical value

  1. #1
    Registered User
    Join Date
    11-13-2006
    Posts
    11

    Text returning a numerical value

    I want to be able to type in a number in a cell and have it summed elsewhere but I'd also be a ble to enter certian text in the cells but have a specified numerical value to the cell even though the text is displayed.

    Example: For a timesheet you would normally put your hours but if you take a vacation the cell would read "VACATION" but the value to the cell would be 8 and the summing would work out correctly.

    Is this something that needs to be done in VBA or can Excel handle this directly?

    Thanks
    Ron

  2. #2
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by slinger1010
    I want to be able to type in a number in a cell and have it summed elsewhere but I'd also be a ble to enter certian text in the cells but have a specified numerical value to the cell even though the text is displayed.

    Example: For a timesheet you would normally put your hours but if you take a vacation the cell would read "VACATION" but the value to the cell would be 8 and the summing would work out correctly.

    Is this something that needs to be done in VBA or can Excel handle this directly?

    Thanks
    Ron
    If you just have the number of hours in the cell, or the word "VACATION", you can do the following:

    =SUM(IF(A2:A15="VACATION",8,A2:A15)) entered with CTRL+SHIFT+ENTER.

    Scott

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Or this non array formula

    =SUMPRODUCT(--(A2:A15="Vacation")*8)

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    10-18-2006
    Posts
    49
    You can also use:

    =C12+RIGHT(B12,1)

    assuming that you enter the vacation in this format: Vacation 8
    (number should follow the word)
    change 'C12' & 'b12' to whatever cell you are trying to add

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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