Getting Cell Data Based on Boolean Values

Vonsteiner

New Member
Joined
Apr 14, 2014
Messages
45
Office Version
  1. 365
Platform
  1. Windows
Ok,

I have a range of 10 cells that will be filled with a true/false value based on a userform. Is there a way I can fill in another cell with the values that are true? In the below examples say Value 1 is in D1 and TRUE is in E1. In cell A1 I would like to show all the cells in D with a true value in E. So, in the top example: "Value 1, Value 4, Value 5, Value 7, Value 8" would be what shows in A1. In the bottom example: "Value 1, Value 2, Value 7, Value 9" would be what shows in A1. I would like to know if there is a formula I can add either in VBA or within a cell.

Value 1TRUE
Value 2FALSE
Value 3FALSE
Value 4TRUE
Value 5TRUE
Value 6FALSE
Value 7TRUE
Value 8TRUE
Value 9FALSE
Value 10FALSE
Value 1TRUE
Value 2TRUE
Value 3FALSE
Value 4FALSE
Value 5FALSE
Value 6FALSE
Value 7TRUE
Value 8FALSE
Value 9TRUE
Value 10FALSE

<colgroup><col width="69" span="2" style="width:52pt"> </colgroup><tbody>
</tbody>


Michael
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try this UDF:

Code:
Function TrueValues(r As Range)
Dim c As Range, s As String
For Each c In r.Offset(, 1).Resize(, 1)
    If c Then s = s & c.Offset(, -1) & ", "
Next
If Len(s) Then s = Left(s, Len(s) - 2)
TrueValues = s
End Function

Then in the cell you want the result:
=TRUEVALUES(D1:E10)


Excel 2010
ABCDE
1Value 1, Value 4, Value 5, Value 7, Value 8Value 1TRUE
2Value 2FALSE
3Value 3FALSE
4Value 4TRUE
5Value 5TRUE
6Value 6FALSE
7Value 7TRUE
8Value 8TRUE
9Value 9FALSE
10Value 10FALSE
Sheet1
Cell Formulas
RangeFormula
A1=truevalues(D1:E10)
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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