formula to fill column based on group condition

bettlejus

New Member
Joined
Apr 4, 2017
Messages
32
Hi,

I have the sheet bellow:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Product[/TD]
[TD]Value[/TD]
[TD]Indication[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]50[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]50[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cherries[/TD]
[TD]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cherries[/TD]
[TD]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


And I want the following result:


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Product[/TD]
[TD]Value[/TD]
[TD]Indication[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]50[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]50[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Cherries[/TD]
[TD]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cherries[/TD]
[TD]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD]TRUE[/TD]
[/TR]
</tbody>[/TABLE]


To fill the column C with value found only on first product but only if the value is a specific text, in this case "TRUE".

Can I do this with a formula?

Thank you!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I cannot save the file in the link, it is ok to fill in another column, but I cannot see the solution in your link.

Thank you!
 
Upvote 0
How about


Excel 2013/2016
ABCD
1ProductValueIndication
2Apple50TRUETRUE
3Apple50TRUE
4Cherries20
5Cherries20
6Bananas45TRUETRUE
7Bananas45TRUE
8Bananas45TRUE
Engine
Cell Formulas
RangeFormula
D2=IF(C2<>"",C2,IF(A2=A1,D1,""))
 
Upvote 0
How about


[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]D2[/TH]
[TD="align: left"]=IF(C2<>"",C2,IF(A2=A1,D1,""))[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

It is ok, except one thing, if my "indication" start lower than the "Product" it does not fill the first line, like this:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Product[/TD]
[TD]Value[/TD]
[TD]Indication[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45
[/TD]
[TD][/TD]
[TD]This must be filled also with "TRUE"[/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD]TRUE[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]Bananas[/TD]
[TD]45[/TD]
[TD][/TD]
[TD]TRUE[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Ok, how about


Excel 2013/2016
ABCD
1ProductValueIndication
2Apple50TRUETRUE
3Apple50TRUE
4Cherries20
5Cherries20
6Bananas45TRUE
7Bananas45TRUETRUE
8Bananas45TRUE
Sheet2
Cell Formulas
RangeFormula
D2=IF(COUNTIFS($A$2:$A$8,A2,$C$2:$C$8,"<>")>0,TRUE,"")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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