PDA

View Full Version : Levels of nesting in Excel Spreadsheet?


cricky075
Jul 18, 2012, 08:25 AM
Hello all,

Right, here's my problem...
First of all column C I have the dates of payment transactions, in a hidden column B I have the formula:
=IF(C5="","",MONTH(C5))

Using the numbered month, I want in column A to display the word of each month when the month starts. For example:
=IF(AND(B5=2,B4=1),"February")

The only problem is that I want a formula to display each month on the left as it starts, this leads me to the huge IF nest formula below:

=IF(AND(B6=1,B5=12),"January",IF(AND(B6=2,B5=1),"February",IF(AND(B6=3,B5=2),"March",IF(AND(B6=4,B5=3),"April",IF(AND(B6=5,B5=4),"May",IF(AND(B6=6,B5=5),"June",IF(AND(B6=7,B5=6),"July",IF(AND(B6=8,B5=7),"August",IF(AND(B6=9,B5=8),"September",IF(AND(B6=10,B5=9),"October",IF(AND(B6=11,B5=10),"November",IF(AND(B6=12,B5=11),"December","")

I'm sure the answer to this is yes but is there any way to simplify this to make the Excel software happy?

Thank you in advance.

suzier
Jul 18, 2012, 09:34 PM
My recommendation is not exactly what you have asked but obtains results in a less laborious way.

1. Instead of using the "month" formula, copy all of Column C (C:C) into B. Label the column Month.
2. Select Column B (B:B). Right Mouse Click and select "Format Cells".
Select "Custom" in the Category List. The type mmmm in "Type"
3. Select "Sub-Totals" from the data dropdown menu.
Select "At each change in:" --> Month
Use Function: ---> I recommend you select count or sum(if there is a column such as amount).
Add Subtotal to (I recommend the date column if using count or numeric column for sum).
Uncheck the "Summary below Data" checkmark

Select OK

The description will include the word "count" if you use the count function. You can do a "find" and replace on the word. Additionally, you may want to alter the "Grand Count" row at the beginning.

cricky075
Jul 19, 2012, 01:27 AM
Solved by other means. Thanks for your help.

JBeaucaire
Jul 19, 2012, 10:53 AM
You've forgotten that you can format a date to display any way you want. You don't need the hidden column for this. If there is a date in C2, then this formula in A2:

=TEXT(C2, "MMMM")

... should give you the simplest results.