# Change Worksheet Structure Based on Cell Value?

#### Cerestes

##### Board Regular
This is complicated I think.

Basically, its a simplistic sheet to tally 3 variables over the course of a month.

I'm trying to make it alter the structure automatically because I don't want to have to make a new sheet every month.

Drop down menu in cell A1 = Month.
Column A has date (1, 2, 3, 4)
Column B has day (Monday, Tuesday, etc)
B2 uses a value lookup to determine the first day of the month based on month chosen.

This is where it gets sloppy:
B3 uses a value look up (B2 = Monday responds with Tuesday, Tuesday with Wednesday, etc)... Is there a better way to increment days? (Cell value = Monday, something like B2 + 1 doesn't appear to work).

Anyway, the Vlookup method works for that.

Problem is, I would like to add weekly subtotals (Saturday through Friday) in the middle of the sheet.
The location of the subtotal row will change based the date that the month started with...

Does this make sense? Is there an "easy" (non VB) way to do this?

### Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

#### tactps

##### Well-known Member
Firstly, to get days, format cell as "ddd". You can then use the b2+1 formula.

=if(weekday(b10)=6,sum(c4:c10),"")

which will subtotal the last 7 days in column c if the weekday is Friday.

#### Cerestes

##### Board Regular
Ah, thanks for the formatting tip, ddd worked well and removed an ugly vlookup.

I had thought about doing the extra column subtotal as you mentioned, had kind of pegged it as a last resort.

Anyone know of a way to force a subtotal row to generate based on the month chosen? That would be the optimal solution =)

#### tactps

##### Well-known Member
Without VBA, I don't see much choice. The other option is to use a fomula to pick up month only (eg =month(a2)) and then do a subtotal via the data menu on that column.

Otherwise, VBA is the way to go, as far as I see it.

#### Cerestes

##### Board Regular
I had pretty much figured that without VBA it wouldn't be possible. Was just hoping.

Along a similar track, is it possible to add/remove rows (in a fixed position) based on a cell value?

Thinking it'd be nice if it removed the 29/30/31 rows if Month=February...

#### tactps

##### Well-known Member
Use if formulas:

=if(and(month(a1)=2,day(a1)=29,"",formula here)

or something like that

Replies
0
Views
231
Replies
2
Views
184
Replies
6
Views
292
Replies
3
Views
176
Replies
3
Views
272

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,152,100
Messages
5,768,097
Members
425,453
Latest member
bince

### 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.

### Which adblocker are you using?

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

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