# Highlight rows using indirect function to fetch highlight frequency

1. ## Highlight rows using indirect function to fetch highlight frequency

Hi

I realize this is not exactly rocket science but I'm only a self taught beginner.

Basically I wish to apply some conditional formatting to a worksheet whereupon cells rows are highlighted every so often. The frequency for this will be determined by a cell value somewhere on the workbook. This frequency corresponds to days in the week to be left blank with the in between cells highlighted. The value will be a number between 1 and 7. Based on this value all cells (corresponding to # 1) or every 2nd, 3rd, 4th 5th or 6th cell or no cells (corresponding to # 7) in the row will be plain with the in between cells highlighted.

I hope that my description makes sense. The end result is highlighting in black some of the days in the row to bring the focus to just the days desired.

I assume that something I need to use something like MOD(ROW()-2,Sheetname!CellReference with further parameters specifying which cell to start highlighting from and how many cells to highlight in succession I don't for the life of me know how to make this work

Ignoring the cell look up part the code =MOD(ROW()-1,2*2)+1<=2 almost achieves the result I need when I wish to have the 1st cell then every 3rd cell clear and the rest highlighted. It leaves clear the 1st cell, highlights the next 2, leaves 2 clear (I only need 1 clear) then highlights 2. If I can modify this code to work I can then perhaps work out how to derive some of the numbers from external cell references using direct links or the indirect function.

If I approach this from the other direction and start with all rows highlighted I can un-highlight every 3rd cell using =MOD(ROW(),3)=1 Deriving the 3 from an external cell is easy =MOD(ROW(),Sheetname!CellReference)=1 I suppose that I can use this reverse system if required. This still needs to be modified as the system doesn't work when the value in the linked cell is anything other than 3.

A completely different approach and perhaps a slicker design would be to forget about the highlighting and simply have some code whereupon initially all 7 days of every week contained data but code performs a master count using the cell reference from another location and the result is that only every 2nd, 3rd... every 7th cell displays anything at all. i.e an if cell row is for instance 3rd in a repeated count of 3 display text/run formula if not display nothing kind of arrangement. The intermittent cells return nothing/appear empty. This would perhaps b the best outcome, to clarify again I'm looking for a method to break up my rows of 7 cells so that intake days are differentiated from non intake days, be this through having blank cells on non intake days or by highlighting the non intake days black.

Can anybody be of assistance? Sorry that the post has turned out so long and confusing.

Thank you very much in advance

P.S just attached a sample as requested. I tried to remove most of the unnecessary stuff.

Basically it's a weekly/daily planner for food and or supplement intake (I'm a fitness enthusiast/bodybuilder).

1st sheet is where parameters are entered including intake schedule. The days per week here will be later used to denote highlight frequency.

Sheet 2 is where user sets out weekly intake amounts.

Week 3 is where daily schedule is generated. I want the days where there is no intake to be highlighted (blanked out). My question only addressed week 1, in reality this planner is designed to be set up for up to 25 weeks. I will have to later work out how to pre-define the weeks as 7 row blocks and ignore the spaces in between. I will also eventually try to have the daily intake page largely automatically generate from the weekly layout sheet. Atm I have some basic indirect functions in place but it's rudimentary and requires copying and pasting to generate successive weeks. The weeks do automatically adjust the data to reflect successive weeks but as I don't know how to code to only input data i to the appropriate cells of the week I plan to enter data into every cell as if all items were to be consumed every day then simply blank out the days to be ignored.

Michael from Australia.

2. ## Re: Highlight rows using indirect function to fetch highlight frequency

Hi Michael

I think that will be usefull for all, if you upload a small sample workbook

3. ## Re: Highlight rows using indirect function to fetch highlight frequency

I modified my original post to included a modified version of my workbook

Thanks

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1