Find which range a cell belongs to [closed] - excel

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have an excel sheet with columns A and B populated with numbers, a la:
1 12
13 20
21 30
31 35
This is just as an example, in reality A and B are columns of length 50ish.
In this example, I have another column with values in it between 1 and 30. I want to write a function that returns which range it is between. Perhaps a 1 if it is between the first range (1-12) 2 between the second (13-20) etc.
This is the way the data was presented to me, if it needs to be re-arranged so be it.
Does anyone know any functions that would be useful to solve this problem? I have read that nested if statements are limited to 7 "if's" so I would need to write out a bunch of them.
Thanks folks.

As #Tim has said, =MATCH looks most suitable, without its optional third parameter, so that it “finds the largest value that is less than or equal to lookup_value.” Hence the upper bounds (right-hand column in your question) are not required for this formula. The numbers returned are the relative positions of the ‘match’ in the selected array. If your “another column with values in it between 1 and 30” is say C and starts in Row2 then =MATCH(C2,A:A) copied down is a generalisation that will only return 1, 2, 3 if the population of A:B starts in Row1. In other words, if the 1 in A is say in Row3 then I’d recommend:
=MATCH(C2,A$3:A$6)
copied down to suit.
The last number in A (ie 31) can be anything as long as it is more than the upper bound of your “between 1 and 30”.

Related

Formula with Multiple Tables in Excel [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
This is my first post to stack overflow. I've gotten a lot of help from you all over the years by reading others' questions, but I've finally found one I can't find an answer to.
This seems like a relatively straightforward question, but how would I find the average cost of Fruit (cell B15) from the spreadsheet shown in the screenshot without modifying the two tables in any way?
Unfortunately, I can't post an image (bc no reputation) so I'll describe it here:
Two tables:
Table 1 (A1:B5):
Column A = Products (Apple, Celery, Lemon, Carrot);
Column B = Type (Fruit, Vegetable, Fruit, Vegetable
Table 2 (A7:B11):
Column A = Products (Apple, Celery, Lemon, Carrot);
Column B = Cost ($0.45, $0.60, $0.72, $0.86)
B14: "Fruit" <--What I want to find the average price of;
B15: Where the formula will go
Thank you.
In cell B15 enter this formula:
=SUM(IF((B2:B5="fruit"),INDEX(B8:B11,N(IF(1,MATCH(A2:A5,A8:A11,))))))/SUM(IF(B2:B5="fruit",1))
This is an array formula and must be confirmed with Ctrl+Shift+Enter.
Also consider the =SUMIF(range, criteria, [sum_range]) function. It might do just what you need in one simple statement.

Extracting data from text [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I am trying to convert text using only Excel data manipulation functions (not Data/Text to Columns).
Column A looks like this:
A1: 10 11 03,-690000,100.163685
A2: 14 11 03,-761000,100.3977
A3: 17 11 03,-682000,100.575887
and so on.
I'd like to get the date (01 11 03 recognised as a date) in column B, the middle data (between the two commas) in column C and the data on the right (after the second comma) in column D using the full accuracy displayed.
Seems you have options that would be easier, but please try in B1:
=DATEVALUE(LEFT(A1,2)&"/"&MID(A1,4,2)&"/"&MID(A1,7,2))
in C1:
=1*MID(A1,FIND(",",A1)+1,FIND(",",MID(A1,FIND(",",A1)+1,99))-1)
in D1:
=1*MID(A1,FIND(",",A1,FIND(",",A1)+1)+1,99)
and copy down to suit.
I believe the easiest way for you to handle this situation is to simply save your current worksheet as a text file, and then reopen it in Excel. When you open the file again in Excel it should automatically separate out the three columns the way you want it. Here is a screen capture from my Excel after I have done this:
Next you can format the A column as a date however you wish.

use Excel to count numbers in specified range [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
suppose we have following data
23
30
27.5
18
4
11
9
10
16
24
56
90
65
17
19
44
72
and i want to count number of elements in range [10-60] ? sure we can use if for determining if our value is in interval,but is there any function in excel like countrange or something like this which takes input as a vector and also range and returns number of element which fits in that range?thanks very much
This should also work:
=COUNTIF(A1:A17;">=10")-COUNTIF(A1:A17;">60")
A1:A17 is the range of course.
I think you can do this using COUNTIFS function
=COUNTIFS($A$2:$A$9, ">=10",$A$2:$A$9,"<=60")
COUNTIFS
Check out COUNTIF
COUNTIF function counts the number of cells within a range that meet a single criterion (condition) that you specify.
=COUNTIF(range, criteria)
Also there is COUNTIFS
http://office.microsoft.com/en-us/excel-help/count-numbers-greater-than-or-less-than-a-number-HP003056117.aspx
I don't think there is a build in function to do that. You'd need to write one on your own at takes a range of fields, iterates of all elements and increments a predefined return value if a field meets your requirements.
You can read how that's done here: Creating custom functions
Considering the latter part of your question (ie for a number of ranges rather just than a single one) yes, there is an Excel function for this, =FREQUENCY.
The answer for [10-60] is 11, as shown below, but with the upper limits for the bins in ColumnC, one array formula will populate all counts for the ranges selected:

How to find the largest value for each row and save it into an extra column [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have an excel file with several columns, which looks as follows
ID1 ID2 ID3
1 2 3
6 5 4
7 8 9
I would like to add one extra column, which stores the largest value for row. How to do that in Excel?
Assuming that the data you have is in Columns A through C and rows 1 through 4, put the following formula in column D, and copy it down as far as necessary:
=max(A2:C2)
In the extra column (say D1) put : =max(A1:C1)
You can paste it downward.

Excel: search for string in row and find column [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I would like to search a row for a string and get the column number if there is such a string.
Is this possible by using worksheet functions in Excel?
You can use MATCH to give the position, e.g. you can search in row 2 for "xyz" like this
=MATCH("xyz",2:2,0)
If "xyz" is found first in J2 you get 10
if you want partial matches then you can use wildcards like
=MATCH("*xyz*",2:2,0)
so if F2 contains [abc xyz 344] you get a match with that and formula returns 6
I believe VLOOKUP is the best for you.
There's also others like HLOOKUP, LOOKUP and SEARCH
If the lookup value is "value" and it is in row 1
=MATCH("value",1:1,0)
Assuming you have something like this:
A1 A2 A3 A4
111 aaa sss bbb,
you could write something of this sort:
=FIND("$", CELL("address",OFFSET($A$2, 0,MATCH(111,A2:D2,1)-COLUMN($A$2)+1)), 2)
Ugly, but works (assuming that's what you were looking for)...

Resources