Chossing a row's value based on a dropdown in sheets - google-sheets

I want to choose one of data from column B and column C based on column D to be entered in column E.
A
B
C
D
E
Jan
100
200
B
=Formula to get 100
Feb
101
201
C
=Formula to get 201
March
102
202
C
=Formula to get 202
Apil
103
203
B
=Formula to get 103
Things I will do:
Add data validation in column D so I can change it to dropdown.
Data in column E should change dynamically as D is changed.
Some useful functions I found:
Choose
If

If you have many column then use INDEX/MATCH combinedly-
=INDEX($B$2:$C,ROW()-1,MATCH(D2,$B$1:$C$1,0))

try in row 1:
=INDEX(IF(D1:D="B"; B1:B; C1:C))

I ended up using the following formula:
=CHOOSE(MATCH($D2,$B$1:$C$1,0),$B2,$C2,0)
Thanks to answer by harun24HR.

Related

Google Sheets: lookup a value in a table then find right most non-blank value in a range

I would like to create a google sheet formula that will lookup the ID and return the right-most non-blank score from columns 'Score A', 'Score B' and Score 'D'. Any help would be much appreciated!
ID
Score A
Score B
Score C
Type
2342
65
43
A
8797
B
2343
23
45
98
F
6666
23
B
2333
67
43
B
Assuming E1 is your search_key here's what you can try:
=LET(ζ,TOROW(XLOOKUP(E1,A2:A,B2:D),1),INDEX(ζ,,COUNTA(ζ)))
You may try:
=ifna(lookup(9^9,xlookup(F1,A:A,B:D)))
You can use the following formula. It concatenates for each row the 3 columns into one string and extracts via regex all characters after the last space.
=VLOOKUP(2342,
{
A:A,
ARRAYFORMULA(IFERROR(REGEXEXTRACT(TRIM(B:B&" "&C:C&" "&D:D),"\b(\w+)$")))
},
2)
Just for adding one more option. It won't matter if they're numbers or not, neither if you have empty cells; it will find the non empty cell most to the right
=LET(r,INDEX(2:1000,XMATCH(E1,A2:A)), INDEX (r,,MAX(COLUMN(r)*(r<>""))))

How to find the row of a specified value than return a corresponding value on a different column Google Sheets

I'm trying to write a formula in Google Sheets which can first locate the row of a specific value. Then index to the value contained on that row a few columns over.
Let's assume the following
A B C
1 12 80
2 43 35
3 64 15
4 13 56
5 44 93
6 86 48
7 14 31
8 41 3
9 63 56
10 11 46
Values in column B and C have a correlated relationship. I need to first locate a specific value in column B than find it's corresponding value on the same row in column C.
For the sake of example, let's assume I'm trying to locate the row containing the value 41 in column B. And then would like to return the corresponding value in column C, which in this case would be 3.
The reason why I need a formula like this is because the data I'm using is highly variable and large. Over 4000 rows. It is unknown what rows the values to be found sit on.
You may try either:
=filter(C:C,B:B=D2)
OR
=xlookup(D2,B:B,C:C,)
filter() will output all instances of rows(column C) which has 41 in column B while xlookup will pick just the first match of 41 within the column

Google Sheets Formula for a range of answers

Trying to figure out a formula to automatically grade based on a range - for example, if the answer (number) in Column C is between...
70 - 94 = WTS
95 - 115 = EXS
116 - 140 = EXC
Sample data in column C:
76
96
95
123
115
I'd assume I'd put the formula in column D to get the outcome based on the range - so if the answer is between 70 and 94 I want column D to recognise this and put the response WTS. Following the rest of the ranges, I want to be able to use this formula for all data in the column.
Here is a link: https://docs.google.com/spreadsheets/d/1tLzm5u4tvWtDtNSxlN5COrkIm8w10_kyi7oobSzG5v8/edit?usp=sharing
Use XLOOKUP() function.
=XLOOKUP(C2,{70,95,116},{"WTS","EXS","EXC"},"",-1)
To spill results dynamically use XLOOKUP() with MAP() function.
=MAP(C2:C6,LAMBDA(x,XLOOKUP(x,{70,95,116},{"WTS","EXS","EXC"},"",-1)))
To refer full column as input try the following.
=MAP(C2:INDEX(C2:C,COUNTA(C2:C)),LAMBDA(x,XLOOKUP(x,{70,95,116},{"WTS","EXS","EXC"},"",-1)))
try:
=MAKEARRAY(COUNTA(C2:C),1,LAMBDA(r,c,VLOOKUP(INDEX(C2:C,r),INDEX({--REGEXEXTRACT(G:G,"^\d+"),REGEXEXTRACT(G:G,"[A-Z]+$")}),2,1)))
-

Google Sheets solution

I have a spreadsheet with 3 columns, Column A has values that increment by 10 and column b has the incrementation difference AKA...
Column A
Column B
Column C
125
135
5
135
145
6
145
155
7
Ext... (There are hundreds of rows with these incrementing values)
I also have a value that is placed in an arbitrary place such as "137" we'll call it D1
I need to cycle through the columns some how and find out...
If D1 is => 135 and less than 145 and if so, place the value of column C in another cell AKA(E1).
If D1 is => 135 and less than 145 and if so, place the value of column C in another cell AKA(E1).
Try the following in E1:
=arrayformula(if(isbetween(D1:D,135,145,1,0),C1:C,))
EDIT
i need to cycle through columns A and B and find where my D1 number fits and output the corresponding C value to E1
Try:
=arrayformula(vlookup(D1:D,{A1:A,C1:C},2))

get the total value base on month

i'm trying to get the total of value bas on month like this.
=SUMPRODUCT(MONTH($A$2:$A$10)=MONTH(C2);($B$2:$B$10))
have even try
=SUMPRODUCT(--(TEXT($A$1:$A$10,"yyyy-mm")=C2);$B$1:$B$10)
but all i get is Zero.
here is some sample
Column A b c d f g
2012-10-02 45 2012-10 45 2012 229
2012-09-05 45 2012-09 100 ect.
2012-09-03 55 2012-08 84
2012-08-25 84 ect.
etc.
ect.
thx in advance
with Excel 2010, you have the power of SUMIFS.
I would rewrite the formula as:
=SUMIFS(B:B;A:A;">="&DATE(YEAR(C2),MONTH(C2),1);A:A;"<"&DATE(YEAR(C2),MONTH(C2)+1,1))
which translates to:
Sum column B if the column A value is equal to or greater than the 1st of the month in C2, and less than the 1st of the next month
looking at column F, the same formula for the year would be:
=SUMIFS(B:B;A:A;">="&DATE(E2,1,1);A:A;"<"&DATE(E2+1,1,1))
Try:
=SUMPRODUCT(--(MONTH($A$2:$A$10)=MONTH(C2));($B$2:$B$10))
But be sure that C is a date column (2012-10-xx). Es 2012-10-01.

Resources