Returning a number if condition is true formula

Dohko

Board Regular
Joined
Apr 13, 2007
Messages
88
Hi,

I need to know if it's possible to do the following in a one formula from the following data.

studyID Review IDno Color
A Normal 1233 Blue
R Special 1233 Blue
A Normal 1234 Red
B Normal 2222 Red
R Special 2222 Red
B Normal 2228 Yellow
C Normal 3859 Yellow
R Special 3859 Black
C Normal 3477 Black
D Normal 4447 Green
D Normal 4448 Green
R Special 4448 Green

I need to return a number depending on which color is selected.
Let's say Blue=1, Red=2, Yellow=3,Black=4, Green=5
But it is conditioned by the following.
So for example I need to count the entries in which Idno=Idno where review=Special and study=A
So if 1233=1233 and study = A it should return a 3.
I need to reference a Whole column not just a defined set.

Thanks for any insights.
 
Hi.

Your request is confusing.
1233 is (almost) always equal to 1233.

You've given us a sample of input data.
Can you show EXACTLY what the output data should be, for that entire set ?
 
Upvote 0
Basically I have two people rating a certain item.
But not all items are rated by two people.
So only the one's that say Special have a second rater.
When that happens the Idno would be the same.
Basically I need to be able to say that if the Idno's match, I need to display the equivalent number corresponding to the color selected.
However I need two formulas one for when the review is Normal and when it's special.
In this case they are both the same color so will return the same number but that might not be the case all the time.
 
Upvote 0
I added another entry to make it clearer. Also added how the output will look

studyID Reviewr ID Color
A Normal 1233 Blue
R Special 1233 Blue
A Normal 1234 Red
B Normal 2222 Red
R Special 2222 Red
B Normal 2228 Yellow
C Normal 3859 Yellow
R Special 3859 Black
C Normal 3477 Black
D Normal 4447 Green
D Normal 4448 Green
R Special 4448 Green
E Normal 7777 Yellow
R Special 7777 Green

Normal Special
1 1
2 2
5 5
3 4
 
Upvote 0
I will write in Pseudo code, since what I'm asking is how to do it in Excel.

So to calculate the first line it would be something like this.
Assuming the following
Let's say Blue=1, Red=2, Yellow=3,Black=4, Green=5


If ID's are equal, study is Normal, and Color is Blue Returns a 1.
If ID's are equal, study is Special, and Color is Blue Returns a 1.

If ID's are equal, study is Normal, and Color is Yellow Returns a 3.
If ID's are equal, study is Special, and Color is Blue Returns a 5.

I do need to check the whole column since I won't know the size of it.
If this feasable with a formula? Or vBA?
 
Upvote 0

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