Write a text based on the numbers of another cell [closed] - google-sheets

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
So I have this data with a lot of different PINs. Each PIN corresponds with a product, so PIN 1205463MB means a product. I want to write the PIN in a cell and automatic write the product name in the next column.
I tried the VLOOKUP function and didn't work , any suggestions?
I already tried this formula I found in a Stack Overflow post, but didn't work either.
=INDEX($B$4:$K$9;MATCH($A$17;$A$5:$A$9;0);COLUMN(A4))
Also in a near future another PIN will be added and then the answer to my problem need to be an easy one to adapt.

You can use the VLOOKUP as it is exactly what you are asking to do:
In this image you can see on the left I have the table with the pins and its product names.
Then on the right, I put another column where I will manually insert the PIN. The column next to it has a dynamic formula (which means that it will fill in the rows below if necessary) that will look for the value you put on the left.
=ArrayFormula( if( len(D2:D), VLOOKUP($D2:D, A2:B16, 2, false),))
^^^^^ ****** ^ *****
arguments: || || | ||
1. column with manually inserted pin----| || | ||
2. whole table you are looking for the value---| | ||
3. number of column you want to retrieve (prod name)-| ||
4. flag to say the table is not sorted---------------------|
This means, every PIN that you will have on the left will have the product name automatically setup on the column with the formula. The dynamic formula as you can see fills the whole column, as I put a random pin on the cell D6 and it filled the product name as well.

Related

How to reference to a previous row within a column with Arrayformula in Google Sheets [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
i'm working on a schedule tool, but can't figure something out. I'd like to use the arrayformula function in Google Sheets. It should sum up two values from the previous row.
At the moment I'm using this, but i'd like to convert it into an arrayformula. I've tried several things, but end up with the 'Circular dependency detected' message.
=iferror(IF(REGEXMATCH(C5;"DAY");E5;index(G:G;ROW(G5)-1;1)+H6);index(G:G;ROW(G5)-1;1)+H6)
Here's the doc:
https://docs.google.com/spreadsheets/d/15jXayEN_vjK3nMRjLjaiLspT_rh_rBD_WX_LAZETRSU/
try:
=INDEX(IF(IFERROR(REGEXMATCH(C3:C; "(?i)DAY")); E3:E; SCAN(E3; H3:H; LAMBDA(x; y; x+y))))
Use the sumif(row()) pattern in cell G4, like this:
=arrayformula(
if(
isnumber(H4:H);
E3 + sumif(row(H3:H); "<=" & row(H3:H); H3:H);
iferror(1/0)
)
)
Format cell G4 as hh":"mm. You should turn off File > Settings > Calculation > Iterative calculation.

Fill a cells value based sequence every new row in Google Sheets [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Is it possible that each time a new row is added, the value of a cell is automatically filled based on a sequence that repeats indefinitely?
What I need to do is fill in the Sales Rep name in a column (there are only 6 sales reps in the list) every time a new cell is added.
Here is the spreadsheet I'm working with (the expected result is on "Leads Desired Outcome" and the formula I tried is on "Failed test".
https://docs.google.com/spreadsheets/d/1wvA7t7-S5agwDNEy_N5eIe58YPT1-9vZY8uWwB4sUZQ/edit?usp=sharing
Any help is appreciated!
use in E1:
={"Sales Rep"; INDEX(VLOOKUP(ARRAY_CONSTRAIN(FLATTEN(
SEQUENCE(ROUNDUP(ROWS(A:A)/MAX('Sales Reps'!A:A)), MAX('Sales Reps'!A:A))-(
SEQUENCE(ROUNDUP(ROWS(A:A)/MAX('Sales Reps'!A:A)), 1, 0)*MAX('Sales Reps'!A:A))),
ROWS(A:A)-1, 1), 'Sales Reps'!A:B, 2, 0))}

Sum in a column until it meets another category [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm building a google sheet to keep track of my money.
I'm pretty new to all this and I'm learning how to do a few things.
I'd like to build a table where I can have categories (in green) and their subcategories. So I'd like to be able to have the sum of the sub categories in front of their parent category.
Also, this is a template that is probably going to change over time, so I'd like it to be modular (it would be simple otherwise) if I add a new subcategory or even a new category.
Thanks for the help.
Here is what I have managed to find and edit, maybe it's a great path... =IF($A3="✹";SUM(E3:INDEX(E3:E;MATCH(TRUE;(A3:A="✫");3)));"")
But actually it sums every row that has a star in the "A" column. It doesn't stop until it meet a sun
here is the link to access the sheet
Also, I know that Aspire Budget works that way, but it's a bit too complicated and I need help to understand it...
try:
=SUM(IFERROR(INDIRECT(ADDRESS(IF(INDIRECT(ADDRESS(ROW()+1, 1))="✫", ROW()+1, "×"), 5)&":"&
ADDRESS(MATCH("✹", INDIRECT("A"&ROW()+1&":A"), 0)+ROW()-1, 5))))
Here is a function that works:
=
if(
indirect("A"&(row()+1))="✫",
sum(
indirect(
"E"&(row()+1)&":E"&vlookup(
"✹",
{
indirect("A"&(row()+1)&":A"),
arrayformula(row(indirect("A"&(row()+1)&":A")))
},
2,
FALSE
)-1
)
),
0
)
The basic idea is to search for the next ✹. Then get the range between the two rows ad add them.
Formula rundown
Step 1: Get the values starting after this row
This can be done using indirect. Basically it's A<next row>:A.
The number of row it's simply row(); and the next one row()+1.
So using indirect we get:
=
indirect("A"&(row()+1)&":A")
Step 2: Find the next category
We want to have the number of the next category. This can be achieved using vlookup.
What we do is make an array with the value on the first column and the number of column on the second one. To get the number of row of a value row can be used. So it would like:
{
<range>,
arrayformula(row(<range>))
}
We need arrayformula to make sure it's used as a formula.
<range> would be the value on the last step so together it looks like:
=
{
indirect("A"&(row()+1)&":A"),
arrayformula(row(indirect("A"&(row()+1)&":A")))
}
Now we need to add the vlookup:
=
vlookup(
"✹",
{
indirect("A"&(row()+1)&":A"),
arrayformula(row(indirect("A"&(row()+1)&":A")))
},
2,
FALSE
)
Which is basically getting the value of the first case of ✹. So now we have the number of the next row of the category.
Step 3: Get the range in the middle
Now that we have the value we can get the range of the values to sum. This would be E<next row>:E<row before next category> or with a function:
indirect(
"E"&<next row>&":E"&<next category row>-1
)
so next row is row()+1 and the next category row is the result of the last step. Together:
=
indirect(
"E"&(row()+1)&":E"&vlookup(
"✹",
{
indirect("A"&(row()+1)&":A"),
arrayformula(row(indirect("A"&(row()+1)&":A")))
},
2,
FALSE
)-1
)
Step 4: sum
Now we can add sum to all of it. Nothing complicated here.
Step 5: Add conditional for empty categories
Some categories are empty so we need to check that the next row is an entry. This can be done with the simple if:
if(
indirect("A"&(row()+1))="✫",
<sum formula>,
0
)
So if you put everything together you get the result.
Final thoughts
Even though it seems massive the formula is not too complex. Try looking into it and let me know if there is something that's not clear enough.
Refrences
VLOOKUP (Docs Editor Help)
SUM (Docs Editor Help)
ROW (Docs Editor Help)
INDIRECT (Docs Editor Help)
IF (Docs Editor Help)
ARRAYFORMULA (Docs Editor Help)

Alphabetizing data from the filter function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have data from multiple tabs in Google Sheets that I am combining into one master tab. I would then like the data on the master tab to be alphabetized based on the last name in one column automatically if more information is added. Here is the formula I used to combine the multiple tabs onto the master tab:
={filter(tab1!A5:Z, tab1!B5:B<>"");FILTER(tab2!A5:Z, tab2!B5:B<>""); FILTER(tab3!A5:Z, tab3!B5:B<>""); FILTER(tab4!A5:Z, tab4!B5:B<>"");FILTER(tab5!A5:Z, tab5!B5:B<>""); FILTER(tab6!A5:Z, tab6!B5:B<>"")}
I have not been able to find anything that would work when I google "how to sort data in abc order from a filter function google sheets".
You can use SORT() and there's even an example in its documentation that applies to your situation:
SORT({1, 2; 3, 4; 5, 6}, 2, FALSE)
So if the last name is in column B, which is the second column you could write (formatted for clarity)
=SORT(
{
FILTER(tab1!A5:Z, tab1!B5:B<>"");
FILTER(tab2!A5:Z, tab2!B5:B<>"");
FILTER(tab3!A5:Z, tab3!B5:B<>"");
FILTER(tab4!A5:Z, tab4!B5:B<>"");
FILTER(tab5!A5:Z, tab5!B5:B<>"");
FILTER(tab6!A5:Z, tab6!B5:B<>"")
},
2,
TRUE
)

How to make cell reference static even after inserting a column? [duplicate]

This question already has answers here:
How to maintain absolute cell address even when deleting ranges?
(2 answers)
Closed 5 months ago.
I want to use the sparkline formula on a fix range("G:P").
Everyday i add another column next to column F into my sheet. So Column "G" becomes "I" and so on. The problem is that the formula does update the range aswell.
=SPARKLINE($G54:BM54)
to
=SPARKLINE($I54:BM54)
Is there a way to prevent that?
You can use INDEX or INDIRECT:
=SPARKLINE(INDEX(54:54;7):BM54;{"charttype"\"column";"negcolor"\"red";"color"\"green";"axis"\WAHR})
or
=SPARKLINE(INDIRECT("$G54:BM54");{"charttype"\"column";"negcolor"\"red";"color"\"green";"axis"\WAHR})

Resources