# Pulling a different answer from different cells

#### Stuge

##### New Member
Hi Everyone

I am looking for assistance with trying to get different fiqures pulled if cells equal a certin number.

It needs to work like this

If A1 = 1 then B1 = James If A2 = 1 then B1 = John If A3 = 1 then B1 = George

Please can someone help me with this

Thank you very much

### Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi Stuge,

I think this should work for you.

In B1:
=if(a1=1, "James", if(a2=1, "John", if(a3=1, "George", "XX")))

Replace "XX" with whatever should be in B1 if none of those are true. "" will produce a blank cell

Additionally, if both A1 and A2=1, B1 will say James, because it was the first criteria met.

Let me know if you have any questions.

~Matt

@Stuge

What if both A1 = 1 and A2 = 1 hold at the same time?

Thanks Matt, That worked perfectly!!

Next question is. If B1 now says James can I get that cell to change colour?

Cheers

You sure can!

Under the home tab click on Conditional Formatting. Click "New Rule." If it says "Style" at the top select "Classic." Chang it to "Format only cells that contain..." and set your criteria. Make sure to have the cell/range that you want to apply the rule to selected while you do this.

Let me know if this works.

~Matt

Replies
5
Views
163
Replies
0
Views
92
Replies
17
Views
135
Replies
4
Views
715
Replies
3
Views
151

Threads
1,203,317
Messages
6,054,711
Members
444,742
Latest member
jmartin9247

### 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

### 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