How to randomly select cell and the adjacent cell on excel - excel

I am trying to find a formula on excel that will allow me to randomly select a cell between a range (this part I have found a formula for) and have the value pasted into another cell AND then have the cell next to the randomly selected cell's value also selected and pasted into a different cell.
Not sure if this makes sense so I will explain what I'm trying to do.
I have a column full of years and the adjacent column full of prices that correspond to each year. I want a year randomly selected and pasted into a cell lower down on the spreadsheet, and I want the corresponding price for this randomly selected year pasted next to this cell.
Thank you in advance!
Anna

Say the data is in A1 through B10
In D1 enter:
=INDEX(A1:A10,RANDBETWEEN(1,10))
and in E1 enter:
=VLOOKUP(D1,A1:B10,2,FALSE)
Another approach is to enter:
=RANDBETWEEN(1,10)
=INDIRECT("A" & C1)
=INDIRECT("B" & C1)
In C1 through E1
(Either approach will work if column A contains years rather than names)
Yet another approach is to enter:
=RANDBETWEEN(1,10)
=INDEX(A1:A10,C1)
=INDEX(B1:B10,C1)
In C1 through E1

Related

Turn cell containing "Serial Number" into a hyperlink to a cell containing that same "Serial Number" in another tab and vice versa

Background
Email requests are received. They can be classified into 4:
A.
P.
N.W.
S.E.
There is a spreadsheet with 5 tables namely, Monitoring, A., P., N.W., S.E. tables.
When an email is received, a power automate flow adds the email details as a new row into the Monitoring Table and also into the Table where the request falls under which could be either of the 4 above. Each email is also given an autonumber, the BVC Number which is the "Serial Number" I was referring to in the title of this question.
Let's say an email request came in for A., A., N.W., P., then S.E. then the resulting spreadsheet would look like this:
Monitoring Table:
Cell A1 BVC Number Cell B1 Classification
Cell A2 BVC0001 Cell B2 A.
Cell A3 BVC0002 Cell B3 A.
Cell A4 BVC0003 Cell B4 N.W.
Cell A5 BVC0004 Cell B5 P.
Cell A6 BVC0005 Cell B6 S.E.
"A." Table:
Cell A1 BVC Number
Cell A2 BVC0001
Cell A3 BVC0002
"N.W." Table:
Cell A1 BVC Number
Cell A2 BVC0003
"P." Table:
Cell A1 BVC Number
Cell A2 BVC0004
"S.E." Table:
Cell A1 BVC Number
Cell A2 BVC0005
What I need to be able to do is to turn the BVC Numbers into a hyperlink that leads to where the BVC Number is in the category tabs i.e. if i click on the Cell A2 in the Monitoring table, it would take me to cell A2 in Tab "A." and vice versa i.e. if i click on Cell A2 in the the "S.E." Tab, i would be taken to the Monitoring tab at Cell A6.
I am open using any of the tools like Power Automate, excel hyperlink formula or even excel scripts. Thank you in advance to any soul who will take the time to look at my question.
I would think VBA could provide a cleaner way to accomplish, but of course takes time to write and test. In the meantime, you could use a formula with a helper column.
In my data below, I have 4 sheets (Master, A, B and C). The following formula on the Master sheet, cell C2, will search all other sheets and land on the first match.
=IFERROR(HYPERLINK("#"&CELL("address",INDEX(A!A:A,MATCH(master!A2,A!A:A,0))),master!A2),IFERROR(HYPERLINK("#"&CELL("address",INDEX(B!A:A,MATCH(master!A2,B!A:A,0))),master!A2),HYPERLINK("#"&CELL("address",INDEX('C'!A:A,MATCH(master!A2,'C'!A:A,0))),master!A2)))
Or perhaps easier to view as this:
=IFERROR(HYPERLINK("#"&CELL("address",INDEX(A!A:A,MATCH(master!A2,A!A:A,0))),master!A2),
IFERROR(HYPERLINK("#"&CELL("address",INDEX(B!A:A,MATCH(master!A2,B!A:A,0))),master!A2),
HYPERLINK("#"&CELL("address",INDEX(C!A:A,MATCH(master!A2,C!A:A,0))),master!A2)))
Basically, the Hyperlink will find the first match on that sheet, and then each has an IFERROR wrapper to go to the next sheet. You'll need to modify this formula to search all your other sheets.
Conversely, you'll need a helper column in your other sheets to go back to Master. That formula will be much shorter, such as this one found in sheet "A":
=HYPERLINK("#"&CELL("address",INDEX(master!A:A,MATCH(A!A4,master!A:A,0))),A!A4)
"Master" sheet:
"A" sheet:

Google Sheets or Excel: setting the value of a remote cell from a formula

Is there a way to create a formula in one cell that will change the value in another cell based on some criteria, without scripting? Example: cell a1 contains a numerical value. cell b1 contains a value from a drop-down list, say, "YES,NO". If cell b1 is set to "YES" I want to remove (set to zero) the value in cell a1. What I'd like to do is have a formula in cell c1 that interrogates b1 and sets the value in a1 accordingly. Is the only way achieve this writing code and using setValue?
you cant remove it without a script. you can visually hide it in various ways. if the A1 is subject of further sum (as in your case per your comment) the sum formula can be always altered to reflect desired output. example:
if your formula is
=SUM(A1, C5, D22)
you can do
=SUM(IF(B1="YES", 0, A1), C5, D22)
Use the following on the cell you need the calculation (or zero) on:
=IF (B1="YES",0,SUM(A:A))
Using the given formula, you would do the SUM calculation for the whole Column A if the value on B1 is "YES", if not, then a 0 would be placed on the cell you put the formula on.

Sum by row with reference to other cell values

I have a vague memory doing this a year back and want to repeat the function. I want to use B2 as a reference to my formula, where my formula is reading in values from another tab and can be expanded by dragging and dropping. My picture is trying to illustrate the issue,
The pink cells are not using the reference cell B2, heading Formula 1 show the formula in column B.
The blue cells is what I have now, column D is the results from the formula in column E (row by row). Here I have created the formula in cell D4 and then dragged it down to D6.
The green cell is what I want to achieve, note the discrepancy marked in red.
I want to be able to write the formula in cell D4 and then drag it down to D6. How can this be done without adding new columns.
Use this:
=INDIRECT("'" & $B$2 & "'!C" & ROW())
I added '' around the sheet name in case the sheet name in B2 contains spaces.

Can Excel increase Cell 1 until Cell 2 matches Cell 3

I am trying to figure out a way to get Excel to increase a cell, A1, that controls another cell, B1, until B1 equals a constant cell, C1.
For instance, the industry standard to do a task is 4000 hours and is a constant; cell C1 = 4000.
Cell A1 is the number of work weeks my team must work to finish this task. Cell A1 drives a lot of calculations but arrives at cell B1, which is the work Hours necessary to complete the task. I must change the work weeks (A1) to change the work hours (B1) to match the standard. Changing A1 changes B1 (on a wicked curve, which negates using a straight up formula). I need B1 to equal C1 by letting Excel change A1. A1 will then automatically tell me how many weeks the team should work. I cannot find a formula and I don't know how to increment A1.
The examples below show me hand-jamming A1 which moves B1 closer to matching C1. C1 then gives me the proper number of weeks based on my
A1=10.00 B1=1900 C1=4000
A1=15.00 B1=2850 C1=4000
A1=20.00 B1=3800 C1=4000
A1=21.06 B1=4000 C1=4000
Ideas?
Suppose the formula in B1 is =A1*190. DATA > Data Tools, What-If-Analysis, Goal Seek..., Set cell: B1, To value; 4000, By changing cell: A1.
The formula in B1 may be very much more complex and refer to various other cells and ranges.

copying the data from formulated column in Excell?

Hi I have three columns in MS Excell. The columns are A1,B1,C1. C1 is calculated automatically based on formula. The formula defined for C1 is(=A1+B1). I mean C1 is the sum of A1 and B1. Now the problem is I wanted to copy the value of C1 to A1 and want to make the B1 column filled with 0.
The moment i try to copy C1 and paste it into A1 the A1 is displaying as "#href" something like this. so how do i copy the value of C1(without Formula) and then paste it to A1?
When you copy from C1 in A1 Excel is trying to insert in A1 the same formula contained in C1 with your relative addresses adapted to the new position, so the new formula in A1 should sum the two cells at the left of A1, but there are not cells at the left of A1, so the #href error is telling you that.
To do what you want you should paste it like "value". You find that option in the Paste command

Resources