+ Reply to Thread
Results 1 to 8 of 8

Two values in one cell?

  1. #1
    Registered User
    Join Date
    11-13-2007
    Posts
    6

    Two values in one cell?

    Hello,

    I'm making a football league table for my IT Coursework and I need to know how I can have two different values in one cell, say for example:

    2-1 was in cell K3, how would I include the 2 in one part of the formula and the 1 in another part of the formula.

    I need this in for an IF function.

    Thanks a lot.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You can concatenate multiple results of formulas into 1 cell with the "&" separator..

    e.g. =Vlookup(A1,B:C,2,0)&"-"&Vlookup(A2,B:C,2,0)

    would result in something like 1-2 if 1 and 2 were the correct result of the 2 functions.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    11-13-2007
    Posts
    6
    I'm sorry for being a bit thick, but I don't understand the V Look up formula.

    http://tinypic.com/view.php?pic=7wsygdd&s=1

    See cell K3, it displays the score 2-1 to Arsenal. I want to have both values in the same cell. I want to have it as an IF function so if the 2 on the left hand side is above the 1 on the right hand side is gives arsenal 3 points and Fulham 0.

    So basically an IF Function with two values from one cell.

    Can you tell him how this is done please.

    Thanks.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    The Vlookups were just example functions that can be concatenated....

    ...but it seems that maybe I misunderstood you...

    I guess you already of the 1-2 in a cell and you want to extract the 1 and the 2 separately, right?

    to extract the 1: =LEFT(K3,FIND("-",K3)-1)+0

    to extract the 2: =MID(K3,FIND("-",K3)+1,255)+0

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    then string it all together like this
    =IF((LEFT(K3,FIND("-",K3)-1)+0)>(MID(K3,FIND("-",K3)+1,255)+0),3,IF((LEFT(K3,FIND("-",K3)-1)+0)=(MID(K3,FIND("-",K3)+1,255)+0),1,IF((LEFT(K3,FIND("-",K3)-1)+0)<(MID(K3,FIND("-",K3)+1,255)+0),0)))
    but that looks messy i'm sure theres a better way

  6. #6
    Registered User
    Join Date
    11-13-2007
    Posts
    6
    Thanks to the both of you.

    But what I was wondering was how do I add the ""'s to the formula, so when nothing is entered into the cell, it makes their be no points added, so it leaves the cell blank?

    Thanks a lot.
    Pupil.

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You can add an IF right at the start of your formula to take care of that...

    e.g. =IF(K3="","",IF(.......))

  8. #8
    Registered User
    Join Date
    11-13-2007
    Posts
    6
    Quote Originally Posted by martindwilson
    then string it all together like this
    =IF((LEFT(K3,FIND("-",K3)-1)+0)>(MID(K3,FIND("-",K3)+1,255)+0),3,IF((LEFT(K3,FIND("-",K3)-1)+0)=(MID(K3,FIND("-",K3)+1,255)+0),1,IF((LEFT(K3,FIND("-",K3)-1)+0)<(MID(K3,FIND("-",K3)+1,255)+0),0)))
    but that looks messy i'm sure theres a better way
    Thanks very much, it works.

    How do I reverse this formula though so it works for away games, I've tried changing all the "LEFTS" into "RIGHTS" that doesn't seem to work.

    Sorry for being such a burden.

    Thanks a lot.

    Pupil

+ 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