Page 1
Page 1
Started By
Message
locked post

Excel formula question

Posted on 12/19/12 at 9:28 am
Posted by Motorboat
At the camp
Member since Oct 2007
22666 posts
Posted on 12/19/12 at 9:28 am
I want to enter a value in column A and have a corresponding value populate Column B. For instance if I enter "XYZ" in A1, then I want $40 in B1. Or if I enter "ABC" in A1, then I want $50 in B1. How do I do this.

The "IF" function is not doing it for me.

TIA
Posted by RickAstley
Reno, Nevada
Member since May 2011
1995 posts
Posted on 12/19/12 at 9:45 am to
I use Conditional formatting on cells that takes care of the programming for me. Unfortunately, being a technical guy, my excel knowledge is on a novice level.
Posted by Motorboat
At the camp
Member since Oct 2007
22666 posts
Posted on 12/19/12 at 9:49 am to
quote:

RickAstley


Never gonna give you up, never gonna let you down. Thanks anyway.
Posted by datdude3384
Member since Sep 2007
249 posts
Posted on 12/19/12 at 9:54 am to
Vlookup with a table of abc and xyz sorted alphabetically (descending) with their corresponding values adjacent
Posted by hiltacular
NYC
Member since Jan 2011
19665 posts
Posted on 12/19/12 at 9:58 am to
Posted by BennyAndTheInkJets
Middle of a layover
Member since Nov 2010
5593 posts
Posted on 12/19/12 at 10:01 am to
How are "IF" formulas not working for you on this? Are you putting quotation marks around the text you want to see in Column A and also formatting cells in Column A as general?
Posted by Motorboat
At the camp
Member since Oct 2007
22666 posts
Posted on 12/19/12 at 10:05 am to
quote:

How are "IF" formulas not working for you on this? Are you putting quotation marks around the text you want to see in Column A and also formatting cells in Column A as general?



I think I may have gotten my quotes in the wrong place. Let me try as suggested in the link and I'll report. Thx

ETA:

From the Link:

Question: In Microsoft Excel, I need a formula for the following:

IF cell A1= PRADIP then value will be 100
IF cell A1= PRAVIN then value will be 200
IF cell A1= PARTHA then value will be 300
IF cell A1= PAVAN then value will be 400
Answer: You can write an IF statement as follows:

=IF(A1="PRADIP",100,IF(A1="PRAVIN",200,IF(A1="PARTHA",300,IF(A1="PAVAN",400,""))))


My formula is this:

=IF(B2="97001",185,IF(B2="97110",48,IF(B2="97104",32,IF(B2="97010",25,IF(B2="97140",59""))))

What's my problem??
This post was edited on 12/19/12 at 10:17 am
Posted by davesdawgs
Georgia - Class of '75
Member since Oct 2008
20307 posts
Posted on 12/19/12 at 10:24 am to
=IF(A1="XYZ";40;IF(A1="ABC";50;""))

Format the cells with the formula as currency.
This post was edited on 12/19/12 at 10:30 am
Posted by Powerman
Member since Jan 2004
162192 posts
Posted on 12/19/12 at 10:29 am to
Have you tried using a vertical lookup table?

Or is it just 2 possibilities
Posted by Motorboat
At the camp
Member since Oct 2007
22666 posts
Posted on 12/19/12 at 10:34 am to
quote:

Format the cells with the formula as currency.


Done and comes back as "false". WTH? Does the fact that my conditional number is not text (a number) matter?
This post was edited on 12/19/12 at 10:36 am
Posted by Spock's Eyebrow
Member since May 2012
12300 posts
Posted on 12/19/12 at 10:35 am to
quote:

My formula is this:

=IF(B2="97001",185,IF(B2="97110",48,IF(B2="97104",32,IF(B2="97010",25,IF(B2="97140",59""))))

What's my problem??


Your problem is, it's unmaintainable and generalizes poorly. What if you had 100 possibilities?

You need to use a lookup table as previously mentioned. Basically, you're trying to implement an associative array or map, which are the computer language terms for it. If Excel hasn't finally provided high-level support for this concept, the traditional way to do it would be to have a column of key values and an adjacent column of item values, each row in this range making up a pair (key, item). Then use the appropriate lookup function on the keys to retrieve the adjacent item.
Posted by LSURussian
Member since Feb 2005
126958 posts
Posted on 12/19/12 at 10:38 am to
quote:

=IF(B2="97001",185,IF(B2="97110",48,IF(B2="97104",32,IF(B2="97010",25,IF(B2="97140",59""))))
There appears to be a comma missing after the "59" and before the "".
Posted by Motorboat
At the camp
Member since Oct 2007
22666 posts
Posted on 12/19/12 at 10:47 am to
quote:

You need to use a lookup table as previously mentioned.


You guys rock. got it. Had no idea this was a function. thanks!
Posted by foshizzle
Washington DC metro
Member since Mar 2008
40599 posts
Posted on 12/19/12 at 5:53 pm to
quote:

=IF(B2="97001",185,IF(B2="97110",48,IF(B2="97104",32,IF(B2="97010",25,IF(B2="97140",59""))))


As the others said, having a lookup table is best.

But if you have to do it this way instead, your formula shouldn't have all the numbers quoted like that unless cell B2 truly is a text value.

For example, if you enter the number 97110 in cell B2 your formula will not match anything. If you enter the string '97110 then it will return the number 48.

After you put a comma between the 59 and the two consecutive double quotes, that is.
first pageprev pagePage 1 of 1Next pagelast page
refresh

Back to top
logoFollow TigerDroppings for LSU Football News
Follow us on Twitter, Facebook and Instagram to get the latest updates on LSU Football and Recruiting.

FacebookTwitterInstagram