Do While or For Loops?

Kaladin

New Member
Joined
Jul 16, 2014
Messages
48
I have a table that looks kind of like this:
T/FTrueFalseTrueTrueFalseFalseFalseTrue
A
B
C
D
E
F
G
H

<tbody>
</tbody>

The values in the blank spaces are either "N/A" or a number. I'm attempting to write something that will hide the row if all of the values under the columns marked "True" are "N/A" but will unhide the row if at least one of the values under a column marked "True" is a number.

I started out with a for loop going across the top to check for "True"s before going down the rows but it would just treat each column individually, instead of checking all "True" columns. Any tips about what I should be doing different are more than welcome.

If you're curious, this is for a dynamic chart to hide the irrelevant categories in an axis if they have no data.
 
That is wonderful. I will test this in the morning as it's quite late and my baby is not having a good evening.

Just to make sure: If C5 E5 and F5 were all "N/A" but J5 was 100, it would still only hide row 3, correct?
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
The baby was restless so I was awake in bed thinking about the problem and came up with a simple solution that I'm sure you would have come up with had I explained my spreadsheet better.

Since it's for a dynamic table, I already had a duplicate table. I changed the raw data from having "N/A" to being NA(). All data under a column marked as "FALSE" also changed to NA(). This means that all I had to do was have a countif function in a helper column to determine if I had 9 NA() cells within the range on that row and if the countif was marked 9 then hide the row. My brain kept working and wouldn't let me sleep so I hopped on the computer and whipped it up in a couple minutes and it works like a charm.

Sorry to make you work for something because I'm bad at explaining things.
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

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