Reference Found Cell in Column & Search The Adjacent Cell

Pandize

New Member
Joined
Jul 13, 2018
Messages
4
Hello,

So the formula I am trying to create is described as this;
Search column for specific text, if text is found, then search the cell to the left of the found cell for specific text. If the text is true, count.

Currently what I've tried is the following;
=SUM(COUNTIFS(D:D,{"TEST1","TEST2"},C:C,"(TEST3)"))

The problem is column C. Instead of searching the whole column, I want it to search the cell next to the one where TEST1 or TEST2 was found for TEST3.
This should apply for all of column D, if it finds any more text matching TEST1 or TEST2, it will search the adjacent ones as well.

Hopefully this isn't as difficult for some of you guys as it has been for me!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to Mr Excel forum

I think you formula has typos
=SUM(COUNTIFS(D:D,{"TEST1","TEST2"},C:C,"(TEST3)"))

Shouldn't it be
=SUM(COUNTIFS(D:D,{"TEST1","TEST2"},C:C,"TEST3"))

M.
 
Upvote 0
Oh, yes. The specific text that I was searching for contained () in it, I just never removed it when replacing the text with "TEST".
 
Upvote 0
So, the formula works now, or not?

M.

The formula that I showed doesn't work how I want it to right now.
C:C is checking the entire column, but I want it to check the adjacent cell that is found by the first section. See;

The problem is column C. Instead of searching the whole column, I want it to search the cell next to the one where TEST1 or TEST2 was found for TEST3.
This should apply for all of column D, if it finds any more text matching TEST1 or TEST2, it will search the adjacent ones as well.
 
Upvote 0
Worked for me


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][td="bgcolor: #DCE6F1"]
F
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Value1​
[/td][td]
Value2​
[/td][td][/td][td]
Formula​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td="bgcolor:#FFFF00"]
TEST3​
[/td][td="bgcolor:#FFFF00"]
TEST1​
[/td][td][/td][td]
3​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
TEST2​
[/td][td]
TEST2​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td="bgcolor:#FFFF00"]
TEST3​
[/td][td="bgcolor:#FFFF00"]
TEST1​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
TEST3​
[/td][td]
TEST4​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td="bgcolor:#FFFF00"]
TEST3​
[/td][td="bgcolor:#FFFF00"]
TEST2​
[/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
TEST6​
[/td][td]
TEST2​
[/td][td][/td][td][/td][/tr]
[/table]


Formula in F2
=SUM(COUNTIFS(D:D,{"TEST1","TEST2"},C:C,"TEST3"))

M.
 
Upvote 0
Worked for me


[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
C
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
D
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
E
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
F
[/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
1
[/TD]
[TD]
Value1​
[/TD]
[TD]
Value2​
[/TD]
[TD][/TD]
[TD]
Formula​
[/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
2
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] "]
TEST3​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] "]
TEST1​
[/TD]
[TD][/TD]
[TD]
3​
[/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
3
[/TD]
[TD]
TEST2​
[/TD]
[TD]
TEST2​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
4
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] "]
TEST3​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] "]
TEST1​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
5
[/TD]
[TD]
TEST3​
[/TD]
[TD]
TEST4​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
6
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] "]
TEST3​
[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFF00]#FFFF00[/URL] "]
TEST2​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DCE6F1]#DCE6F1[/URL] "]
7
[/TD]
[TD]
TEST6​
[/TD]
[TD]
TEST2​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Formula in F2
=SUM(COUNTIFS(D:D,{"TEST1","TEST2"},C:C,"TEST3"))

M.

You are correct! I probably just over-thought it or misspelled it. Thanks for the useful graphic!
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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