+ Reply to Thread
Results 1 to 4 of 4

Return value based on column with data

  1. #1
    Registered User
    Join Date
    03-26-2010
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    42

    Return value based on column with data

    Hi all,

    I'm not sure where I'm going wrong here, please help:

    I am trying to make a column return a number based on another column. For example, if A1 is "Bread," I want B1 to return "10." If A2 is "Cake," I want B2 to read "25." I've been trying various IF formulas, and I'm coming up blank. This hasn't been working:

    =IF(A1=Bread,10)

    Part of the issue is that I'm sleep deprived, but what stupid mistake am I making? Thanks in advance for your help!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Return value based on column with data

    If you have a several possibilities, it would be best to create a table on the side of all the possibilities for A1 and in adjacent column the associated values...

    then simply:

    =Vlookup(A1,$X$1:$Y$10,2,FALSE)

    where X1:Y10 contains the above suggested table.... adjust as necessary.
    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
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Return value based on column with data

    If it is only those 2 options..

    Then : =IF(A1="Bread",10,IF(A1="Cake",25,""))

  4. #4
    Registered User
    Join Date
    03-26-2010
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Return value based on column with data

    NBVC - Thank you so much. My most immediate problem was forgetting the quotation marks with my initial value; but both of your suggestions worked swimmingly. Thank you so much!

+ 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