# Need a Formula

##### New Member
Basically, I have a spreadsheet where there's a ton of data and I need to have a formula that searches through one column row by row, then goes to another column on the same row if the first one returns a certain value. Then, once in the second column, I want it to add a number to a count if that reurns a certain value.

I realize this may sound complicated, so I will put some sample data below.

1 2 3

A Low Yes Yes
B Middle No Yes
C High Yes Yes
D Low No No
E High Yes No
F Low No Yes
G Middle No No

Now, what I need to be able to do is have the formula search through column 1 until it sees "Low", then jump to column 3 on the same row and see if that says "Yes", and if so, count the number. Thus, in this example, I want the formula to return 2, because there are two places (Row A and Row F)where Column 1 contains "Low" and Column 3 contains "Yes". Then, I want to repeat this formula for other columns.

I tried doing it with Countif, but I could only make that work if it was one column. If you need any more info, feel free to ask.

### Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

#### Makrini

##### Well-known Member
=SUMPRODUCT(--(B1:B100="Low"),--(D1:D100="Yes"))

should work for you...

##### New Member
Thanks. If you don't mind, could you tell me how that works?

#### Makrini

##### Well-known Member
Sure..

Sumproduct - obviously multiplies things up...

--(B1:B100="Low")

B1:B100="Low" would return "True","False","False","True".....

the -- turns it into 1 for true and 0 for false...

i.e it returns 1,0,0,1....

multiply that by the result of ... --(D1:D100="Yes")
(1,1,1,0...)

is 1 * 1
0*1
0*1
1*0

etc

Basically returning a 1 every time both values are true - or returning 0 otherwise

Then it adds all the 1's...

Replies
3
Views
242
Replies
2
Views
186
Replies
3
Views
176
Replies
3
Views
111
Replies
4
Views
347

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,511
Messages
5,832,175
Members
430,114
Latest member
kefier

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

### Which adblocker are you using?

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

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