Excel -Using a lower ranked value to display associated cell - excel

i am using excel 2013. From below, e.g. if C2 is ranked 2nd, E2 value takes the value of 1st rank,i.e. 0.008. if C6 is ranked 6th, E6 takes the value of 5th rank, i.e. 0.8.
my question is how to write the formula for E2 to E7? i guess we need array formula? formula is much prefered over vba.
thanks

Try this formula in E2 copied down
=IFERROR(SMALL(D$2:D$7,C2-1),0)
If you want you can do without the ranking column, e.g. based on column D alone, you can use this version
=IFERROR(SMALL(D$2:D$7,RANK(D2,D$2:D$7,1)-1),0)

Related

Finding partial matches within an if statement

Does anyone know how I can write an if statement that searches for partials in VBA? For example, if A2 and A3 both contain Jon, I would like the totals under the 2020 column to be summed, and then it would move down and check the values in A4 and A5. It should work the same way for Mary. But with ben, it should only total A6 because the cell underneath contains Chip. Then it should go down again and check the following two cells for a match. This is for a report that changes weekly, so the names will not always be the same. Any help is appreciated. Thank you.
As Rno said, name uniques would become an issue, but for this small data set you can add another column of name values in column F and do a sumif formula on those separated names.
See Formulas Used Pic
In cell f2 =TRIM(RIGHT(A2,LEN(A2)-FIND("-",A2,1)))
In cell H2 =SUMIF($F:$F,$G2,B:B)

Excel formula: How to refer a cell by its column name

How can I change my excel formula if I need to replace direct reference to the cell by the column name of this cell? For example, instead of
SUM(A1:B1)
I want to use something like
SUM({Column1}:{Column2})
I know about structured reference, but I can not convert my excel dataset into named table.
Do I have any options?
This answer assumes that the column name is the content of the header row for that column.
Say we have data like:
and we want to sum part of the row based on certain months, say between Feb and Jun. In B6 enter Feb and in C6 enter Jun and in D6 enter:
=SUM(INDEX(A2:L2,MATCH(B6,A1:L1,0)):INDEX(A2:L2,MATCH(C6,A1:L1,0)))
So by changing B6 and C6 we can change the part of the second row we are summing.
EDIT#1:
If we re-arrange the headers, the formula should adapt to the re-arrangement
The formula I posted was plain-vanilla. It should work on old versions of Excel as well as the current version. I am using the US Locale. You may need to check the spelling of functions and may need to use a ; rather than a , as the field separator character.

Date Manipulation to output the same date

Good day!
Using Excel and would like to multiply a date by a value to create new a row with the same date
Example;
before
Column A
27-OCT-19
execution
Column A Column b
27-OCT-19 X 4
output
Column A
27-OCT-19
27-OCT-19
27-OCT-19
27-OCT-19
I've looked around and it seems that people use Visual Basic - However, I can't use Visual Basic due to permission issues on my network.
If your first date begins in cell A2 then enter this formula in cell B2:
=MID(REPT(TEXT(A2," dd-mmm-yy"),4),2,99)
Now copy the formula downward as far as you need.
Based on your revised question, the following should work.
With your reference date in cell A2 and your multiply value in cell B2 enter this formula in cell A3:
=IF((ROW()-ROW($A$2))<$B$2,$A$2,"")
Now copy the formula downward as far as you need.
If you have Excel O365 with the SEQUENCE function, you can use:
A3: =TRIM(MID(SUBSTITUTE(REPT(TEXT($A$2,"dd-mmm-yy "),B2)," ",REPT(" ",99)),IF(SEQUENCE(B2)=1,1,(SEQUENCE(B2)-1)*99),99))
and the results will SPILL down as far as required.

Average only the numbers part of cells

I am trying to average some cells, but they contain both numbers and characters. Obviously excel reads these as text so doesn't give an average of the numbers.
What can I use to make the formula only look at the numbers part of the cell? I tried a combination of sum and left but this hasn't worked. Do I need an array formula perhaps (something involving ={sum(left(A1:C1))});
For example
Cell A1 B1 C1
Grade 6a 8b 4c
the answer should be (6+8+4)/3=6
If there is always one and only one letter after the number you could create a second row that strips it off as follows:
Cell A2: =1*Mid(A1,1,Len(A1)-1)
Important to have the 1* part of this formula as then it creates a number. Then you can average this row.
Alternatively you could use the array formula:
=AVERAGE(1*MID(A1:C1,1,LEN(A1:C1)-1))
remember to hit CTRL+SHIFT ENTER when you are done editing the cell. Excel will put {} around the function in the editing window to show it's an array formula.

Excel formula with times in 1904 date system

In Excel I have three columns, say A, B and C, all with the background format of hh:mm:ss and the 1904 date system, meaning that I can do simple arithmetic across the columns.
Cells in columns A and B will mostly be populated with times but can also be either blank or have text in them.
Using cells A1, B1 and C1 as an example I need a formula in C1 which says if both A1 and B1 have times within them then perform the sum A1 minus B1 into C1. So if A1 is 01:07:26 and B1 is 01:08:26 the resultant sum in C1 will be -00:01:00. If blank or text appears in A1 and/or B1 then the arithmetic function will not be performed.
I have been going round in circles with SUMIFS and have not managed to figure out a formula which will do the trick so if anyone could help me I would be very grateful.
I don't have Excel on this machine, but a more fruitful approach would
be something like:
=IF(AND(ISNUM(A1),ISNUM(A2)),A1-B1,"")
If you need more fine-grained checking for a time, see this post.

Resources