Rookie IF Question

electrichi01

New Member
Joined
Aug 10, 2009
Messages
44
Hello

Here is what I am trying to do, perhaps someone can guide me?

Cell A1 is a drop down list to choose between 2 options- Cats or Dogs. whichever you choose will drive the answers below.
If you choose either one- Cats or Dogs, it pulls data from other cells and populates cells A2 and A3 with specific quantities of Cats and Dogs.
Cell A2 is- if it is Cats, then a certain #of Cats
Cell A3 is- if it is Dogs, then a certain # of Dogs
Cell A4 is- If cell A1 is Cats, then grab data from cell A2, If cell A1 is Dogs, grab cell data from A3.

Thanks for your help~
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
In A2: =IF(A1="Cats", #,"")
In A3: =IF(A1="Dogs", #,"")

In A4: =IF(A1="Cats",A2,A3)

But couldn't you just elminate A2 and A3 and have the result in A4 return then numbers you need?
 
Upvote 0
Hi

The challenge is- in A2 I have a Ceiling function and A3 pulls data from another cell.
So, I can't populate those formulas into A2 & A3.
I am trying to grab the result of selecting A1, as all of the other calcs are done from other cells to populate A2 & A3.
Trying to grab the results of those calcs after selecting A1 and choosing the results to populate A4. A4's data comes from A2 & A3.
 
Upvote 0
You can nest functions inside of an if statement.

A2 could be IF(A1="Cats", Ceiling(####), ###)
then A3 would be the same for dogs, and A4 would choose either A2 or A3.

My quesiton is if you're selecting A2 or A3 based on cats or dogs you should just put everything into one if statement like:
IF(A1="CATS", FormulaFromA2, FormulaFromA3)
 
Upvote 0
Hi

I would like to leave A2 & A3's formulas stand alone, as they pull data from other calcs on the sheet.
So, if A1 selects one of the two options- Cats- pull the number of cats from A2 and populate it in A4. If it is Dogs, pull the number of dogs from A3 and populate that in A4.

Does this help?

Thanks again~
 
Upvote 0
If your a2 and a3 functions are working properly, all A4 has to do is determine which one to grab data from right? so all you need to do is have A4 be IF(A1="Cats", A2, A3) and it'll pull a2 if its cats, and a3 if its dogs.
 
Upvote 0
Acidix-
Yes, it seems like it would be, but I am still coming up with incorrect #'s.
When I use that formula and substitute either "Cats" or "Dogs", it still does not pull the correct data from either A2 or A3.
Perhaps explained differently:
If Cats is chosen in A1, then it needs to pull the data from A2 and pop in A4
If Dogs is chosen in A1, then it needs to pull the data from A3 and pop in A4.

It seems when I ask for Cats, it pulls the data from dogs and when I choose dogs, it pulls data from dogs. It also does this in reverse when I change the "Cats" or "Dogs" in the formula, so this is unclear to me.

Any other suggestions?
 
Upvote 0
Sounds like you're having problems with the order of your logical statement. The actual arguments are like this:

IF(logic, TrueValue, FalseValue)

So your logic is going to be A1 ="CATS" for example.

When you select A1 as CATS then the truevalue will be displayed, otherwise the falsevalue will be displayed.
 
Upvote 0
Ok

I agree they should work and it did on a fresh sheet. Perhaps I need to revisit what I am asking for.

A1 has the drop down- Cats or Dogs
A2 has a quantity of Cats
A3 has a quantity of Dogs
A4 gives the result of the quantity, based upon the selection of A1.

Don't think this influences things, but the # in A2 has a ceiling function to come up with the # of cats and A3 pulls the # of dogs from another cell in =B1
When I choose Cats, I still get the Dogs quantity.
Used the correct formula as described. =If(A1="Cats",A2,A3)

Is there another way to approach this?

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,897
Messages
6,122,151
Members
449,068
Latest member
shiz11713

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top