IF AND or something else?

LittleJazzinho

New Member
Joined
Apr 20, 2018
Messages
2
Hi guys, I am currently trying to make a document for work and I am a little bit out of my depth. I'm hoping someone may be able to point me in the right direction or to tell me if what I am trying to do just isn't possible.

I have created a data profile which works fantastically well using pretty basic COUNTIF and IF formulae.
(I am going to find it very difficult to explain whats going wrong without being able to show you guys a picture, I'll try my best though).

My current formulae are:
=COUNTIF(J3:J34,"B")

I would like to expand the above formula to do this...
When C2 reads AUT, count "B" in J3:J34,
When C2 reads SPR, count "B" in J3:J34,
When C2 reads SUM, count "B" in J3:J34.

I would like it to do all these things in one cell (I hope I'm not asking the world). I also have =COUNTIFS(B3:B34, "M", J3:J34, "B") that I would like to apply the same formula to.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Maybe:
Code:
=IF(OR(C2="AUT,C2="SPR",C2="SUM"),COUNTIF(J3:J34,"B"),put here what you want if C2 is none of the three)
 
Last edited:
Upvote 0
My current formulae are:
=COUNTIF(J3:J34,"B")

I would like to expand the above formula to do this...
When C2 reads AUT, count "B" in J3:J34,
When C2 reads SPR, count "B" in J3:J34,
When C2 reads SUM, count "B" in J3:J34.

I also have =COUNTIFS(B3:B34, "M", J3:J34, "B") that I would like to apply the same formula to.

For the first Type:

Code:
=IF(OR(C2="AUT",C2="SPR",C2="SUM"),COUNTIF(J3:J34,"B"),"")

For the second Type:

Code:
=IF(OR(C2="AUT",C2="SPR",C2="SUM"),COUNTIFS(B3:B34, "M", J3:J34, "B"),"")

I have the cells displaying a blank entry if it is not one of the three cases (AUT, SPR, SUM), but you can put whatever you want in the "" argument.

Is this what you were looking for?
 
Last edited:
Upvote 0
I'm so sorry, I put the wrong information in the initial post :confused: I do apologise about that (thank you for replying so quickly btw!)
The correct columns are as follows:

When C2 reads AUT, count "B" in J3:J34,
When C2 reads SPR, count "B" in K3:K34,
When C2 reads SUM, count "B" in L3:L34

How would that alter your above formula? Thank you in advance.
 
Upvote 0
I'm so sorry, I put the wrong information in the initial post :confused: I do apologise about that (thank you for replying so quickly btw!)
The correct columns are as follows:

When C2 reads AUT, count "B" in J3:J34,
When C2 reads SPR, count "B" in K3:K34,
When C2 reads SUM, count "B" in L3:L34

How would that alter your above formula? Thank you in advance.

Maybe this:

=COUNTIF(INDEX($J$3:$L$34,,MATCH(C2,{"AUT";"SPR";"SUM"},0)),"B")

Markmzz
 
Upvote 0
Try:
Code:
=IF(C2="AUT",COUNTIF(J3:J34,"B"),IFC2="SPR",COUNTIF(K3:K34,"B"),IF(C2="SUM",COUNTIF(L3:L34,"B"),put here what you want if C2 is none of the three)))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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