If condition to count column values based on index number - excel

I have 14 column with 1st column (say A) containing the month value (1 for Jan, 2 for Feb and so on). Colum B contain a number representing 2017 year value. For the next 12 columns starting column C onwards, there are values for each month of 2018 starting from Jan 2018 till Dec 2018. In Col 15, i want to sum value of 2017 (Column B) with corresponding months in 2018 based on the month value in Column A. For example, if the month value is 3, then the result should give me the sum of values in column B(2017) + column C(Jan2018) + column D(Feb 2018) + column B (Mar 2018). Since month value 3 represents March 2018.
I tried to use the function Choose but seems too length. Is there a smaller and easy function?

=SUM(B2:INDEX(C2:N2,1,A2))
INDEX(C2:N2,1,A2) here gives the reference within C2:N2 at row 1 and column from cell A2. The range from SUM then becomes B2 to the reference obtained from INDEX.

Related

Excel formula to look up date that corresponds with 2nd 'non zero' value in column

In an excel model with two columns, column A = date by month, column B = cash projections (only two values in column B). Hoping to create a formula to search column b for the second value and return the corresponding month from column A.
In example below, looking for formula to return 'May 20' as answer
Column A
Column B
Jan 20
240,000
Feb 20
Mar 20
Apr 20
May 20
345,000
Jun 20
Tried using a min/max function, however, the second value is not consistently higher or lower than the first value. Assuming it can be done with some type of INDEX or LOOKUP function, however, I am unsure of how to select the second non-zero value

date based on yes or no value in another column

Column G will either be blank or have a yes or no in it. Column L has a date value in it. IF column G has a yes in it I want column R to subtract 9 months from the date in column L. If column G is blank or no I want Column R to remain blank.
Enter this formula in column R (the below formula will work for row 2):
=IF(G2="Yes",DATE(YEAR(L2),MONTH(L2)-9,DAY(L2)),"")
Note that the adjustment of 9 months might look a bit odd. If your date is, say, 30 November 2018, the formula is supposed to return 30 Feb 2018. However, since no date exists, it will instead return 02 March 2018 (which is Excel's way of saying as two days after 28 February 2018).

How to extract day,month,year from a filled cell dynamically new cell we're added as row in Excel?

How to work following things in excel
I have
Column
A. B. C. D
12/12/17. 12. Dec. 17
13/12/17. 13. Dec 17
From column A how to extract date and month and year as shown in column B,C,D?
if any of them entering 3rd and 4 th row on their own, for row 3 and 4 column B,C,D needs to be updated automatically.
Row 3 column A is 14/12/17
Row 4 column A is 15/12/17
Note : not to use fill option in column B,C,D
Day
=Day(A1)
Month
=TEXT(A1,"ddd")
Year:
=--TEXT(A1,"yy")

Get value of cell above last cell in column

I am looking for a formula that will get the value of the cell above the last cell in a column in Excel. I have the following formula that will get the value of the last cell in the column:
=LOOKUP(2, 1/('Historical Data'!A:A<>""),'Historical Data'!A:A)
But I am looking for the value of the cell that is right above it.
For example, if I have a table that looks like:
A B C
2013 09 $40
2014 10 $78
2015 02 $60
I'm looking for column A to return "2014", not "2015" as it does now.
To return the second to last value I would use INDEX.
=INDEX(A:A, COUNTA(A:A)-1, 1)
COUNTA to get the length of your array and -1 to step to the second to last value.
Setup a meta row.
For example, in column "D", adjacent to each cell issue the following formula.
=ROW()
Like so,
A B C D
2013 09 $40 1
2014 10 $78 2
2015 02 $60 3
At the end of the last row, issue a MAX command in the row column. In the aboe example, it will be D4.
=MAX(D1:D3)
D4 will have a value of 3
This tells that your range has 3 rows. You may then get your cell value by
=INDIRECT("A" & D4-1)
Which will give you the value of A2.
You may hide row D after everything checks out.

add values for a range between reference date minus 6 days in excel

i would like to add the corresponding values of dates with reference to a particular date and -6 days in excel.
For example: reference date is 10th feb 15. I would like to add values under flight time column for dates ranging between 10th feb 15 and previous 6 days.
similarly add values for a reference date and previous 30 days values and 1 year values.
What i wanted was, sum all the flight timings of a particular date in column A. I used the sumifs formula to achieve this.
The formula is =SUMIFS($I$8:$I$1122,$A$8:$A$1122,"<="&C8,$A$8:$A$1122,">="&C8-6)
What it does: Here the reference cell is C8 which is 6th Feb 14
step 1- date range for the calculation is 6th feb 14 minus 6 days
step 2- add the values of column I which correspond to all the dates that fall within 6th feb 14 to 31st jan 14
step 3- indicate the sum in column K
Unfortunately i cannot include any pictures or files to show what i have mentioned due to site limitations.

Resources