excel check caller cell on a formula - excel

I have something like
January - February ...
Whatever:
It is, each column is a month and then 1st row has the month name, 2nd row has the number of whatever attribute i want (I'm just putting an example). My idea is to put something like.. in each cell under the month: =cellSomething
and in cell something I should check from which cell I'm calling and then check the month (upper cell) and do something like =If(callerCell.upper.month < May) = 5 else 10
how could I check the caller cell or pass a cell or value to the function?

I'm not entirely sure I understand the requirement, but I would go with something like this:
Use dates rather than names for your column headers (you can then apply formulas to them and also use a custom number format to display the month name). So something like this is what you seem to be asking for:
A1: 01/01/2017
B1: =DATE(2017,MONTH(A1)+1,1)
drag this across to L1
format A1:L1 with a custom number format: mmmm
A2: =IF(MONTH(A1)<5,5,10)
drag this across to L2

We already know where the months are in the first row, so in B1 enter:
=IF(COLUMN()<5,5,10)
and copy across.

Related

How to fix search to header cell?

I have a table like this:
Name
Response
Thursday
A
Monday, Thursday
Yes
B
Tuesday
No
C
Wednesday
No
This is an output of a Google Form response that I use to collect data, In Column C, every cell contains this formula:
=IF(ISNUMBER(SEARCH("Thursday",B2)),"Yes","")
To populate the "Yes". However, its quite cumbersome to replicate this if I want change "Thursday" to something else. When I try to insert it as C1, as I populate down the cells, it auto increment to C1,C2,C3 etc.
Is there a way to fix the formulate to
=IF(ISNUMBER(SEARCH(C1,B2)),"Yes","")
Across all cells and just have B2 increment?
Thanks!
The cell reference that you are using, such as C1, is relative to the formula position. So when you copy the formula one row down, C1 becomes C2 and so on.
To prevent this you need to make the row and or column address absolute so that C1 remains C1 when the formula is copied somewhere else. To make a row or column absolute, precede the row and or column by the character $. To keep the row absolute, you would use C$1 instead of C1. The key F4 will help cycle through the option when the cell address is selected in the formula.

How to make a list of 12 months (loop) not starting at the first month?

Given a date, ex. 05/05/2006, I need to name 12 columns starting with the month of the date given. I realize that I need to make a list of months, I just don't know how to loop it (ie. if one of the months in the middle is December, the next one needs to be January).
The only way I know, from other programming experience, is to make the first column equal to the first month, then make nested conditional statements for the other columns
IF(A1="Jan","Feb",IF(A1="Feb","Mar".......))
I'm sure that there's a better way to do it than brute force (plus, excel doesn't allow me to input that many nested conditionals).
This formula should do the trick:
=TEXT(DATE(2014,MONTH($A$1)+COLUMN()-2,1),"mmmm")
The starting date should be in A1 and first header in B column. If the first header is in another column, you should replace 2 in COLUMN()-2 with the column number.
In the first month column, use =TEXT(A1,"MMMM") where the date is in A1... In the subsequent columns, use =TEXT(EDATE(DATEVALUE("1 "&B1),1),"MMMM") to make a date from the month name, add a month and convert to text.
Assuming your date is in A1, and your columns are in B1 - M1:
Set B1 = A1.
Set C1 = EDATE(B1, 1). EDATE adds the specified number of months to the specified date.
Copy C1 to D1 - M1.
Now you have twelve columns containing the original date and the same date on eleven successive months.
Select B1 - M1; Format Cells; under Number, select Custom; and under Type, enter mmm. This will format these dates to just show the abbreviated month.
Assuming A1 has the date. The following should work
B1= A1 (format as "mmm")
C1 =EOMONTH(B1,1) (format as "mmm")
Copy the above formula and format from C1 for the other columns
Assuming the date is in A1
=TEXT(EDATE(A1,0),"MMMM")
The next column would be
=TEXT(EDATE(A1,1),"MMMM")
... and so on.

Sum only matched values from two columns

Hello Everyone,
Does anyone know how to sum the Hours from column B (Hours) if column A numbers matched with column E and sum by months.
Example, take February data as an example, since only 3000 & 4000 existed in both column A & column E, that's why I need to sum the hours (20+10=30) from column B by it's month below.
I also attached the example excel sheet below.
https://www.dropbox.com/s/0s51g1i8g6s6e2d/Test.xls?m
Thanks in advance. :-)
You could get complicated with customer functions but if having an extra column (potentially hidden) doesn't matter then this would work:
In cell D2 enter:
=iferror(vlookup($A2,$E$2:$E$20,1,FALSE),"x")
Drag the formula down.
Under each month you can then put:
=sumifs($B$2:$B$16,$C$2:$C$16,B$22,$D$2:$D$16,"<>x")
Drag the formula across
This assumes you can change the month format in either column C or row 22 to be the same, ie. Jan, Feb, Mar or January, February, March etc.
Written on the fly and not tested so excuse any minor errors...
Both answers posted thus far are just fine, but just as an alternative, here's what I would do. Put this formula in cell D2 and drag it down:
=IF(NOT(ISNA(VLOOKUP(A2, $E$2:$E$20, 1, FALSE))), B2, "")
Then if you make a column containing the names of the months, say from G2 to G7 you have February, March, ..., July, you can put this formula into H2 and drag it down:
=SUMIFS($D$2:$D$16, $C$2:$C$16, G2)
That should get what you want.
Put this formula in Cell D2 and drag down:
=IF(NOT(ISERROR(MATCH(A2,$E$2:$E$20,FALSE))),B2,"")
In row 22, change the month names to be the full name, OR in column C, change the month names to abbreviated 3-letter names, this is so we can make use of the SumIf function.
Then, in Cell B23, put this formula and drag it across:
=SUMIF($C$2:$C$16,B22,$D$2:$D$16)
(I put the formula in row 24 to check against the data you already had in Row 23)
Shouldn't be much harder without a helper column. Just make sure you have full month name in row 22 to match column C data then use this formula in B23 copied across
=SUMPRODUCT(SUMIFS($B2:$B16,$C2:$C16,B22,$A2:$A16,$E2:$E20))

Excel Date Formula

I have 3 cells in Excel as follows:
Cell
A1=2012
A2=12
A3=15
Which contains year, month & date value respectively. And I want to make a date string out of it.
I know it's very easy to achieve using Date function.
But I also want the cell to remain blank if any of A1,A2 or A3 is blank.
something like
=IF(COUNT(A1:A3)=3,DATE(A1,A2,A3),"")

Excel multiple IF statements, AND statement, and MONTH function

I am working on an excel sheet where I have a month and year value stored in cell D3 as text, this is a start date. The cell contents look like "January 2018". Additionally, in cell F3, I have the end dates which are stored as text. The cell contents look like "April 2018".
The formula I am hoping to build will create a space if D3 is equal to the month of July or if D3 is less than July and F3 is greater than July.
The current formula looks like this:
=IF(MONTH(D3)=6," ", IF (AND(MONTH(D3)<6,(MONTH(F3>6))," ",)))
Any recommendations to get the desired outcome. Thank you!
Maybe:
=IF(OR(MONTH(D3)=7,AND(MONTH(D3)<7,MONTH(F3)>7))," ")

Resources