Allow data to be easily filtered from multiple headings in a single column

cgillies

New Member
Joined
Nov 30, 2017
Messages
4
Hi all,

I am open to any suggestions here.. I have an lot of data that is from a config file that I paste into excel. The data looks like this:

[heading 1]
text 1
text 2
text 3
[heading 2]
text 4
[heading 3]
text 5
text 6

<tbody>
</tbody>


I need to be able to filter the date by heading to show all the entries under [heading 1] etc. I have been thinking of trying to add a column next to the data and copying the heading next to the appropriate text, so it would look like this:

[heading 1]
text 1[heading 1]
text 2[heading 1]
text 3[heading 1]
[heading 2]
text 4[heading 2]
[heading 3]
text 5[heading 3]
text 6[heading 3]

<tbody>
</tbody>

I have blank rows, which I can remove if needed, else the formula should skip these. I have been experimenting with formulas that look for the text starting with "[", copy the cell value to the new column, if it does not match then search in the rows above to return the value of the cell containing [.

The first part of the formula is easy enough:

=IF(ISNUMBER(SEARCH("[",A1,1)),A1,"")

But I am having issues with the 2nd part of the logic. Any help would be greatly appreciated - or f anyone has another suggestion on a better way to get my filtering result I am open.

Thanks in advance,

Cameron
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
You need a running version, you're nearly there
=IF(A1="","",IF(ISNUMBER(SEARCH("[",A1,1)),A1,""))
in col B use the formula (from row 2 down)
=IF(A2="","",IF(ISNUMBER(SEARCH("[",A2,1)),A2,B1))
You could make it one formula using ROW() and OFFSET but that's overkill unless it's going to be used elsewhere
 
Upvote 0
Hot **** !! Thanks so much for a quick and simple response. My faith in humanity is restored. Really really appreciate it!!
 
Upvote 0

Forum statistics

Threads
1,216,103
Messages
6,128,854
Members
449,472
Latest member
ebc9

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