Row dependent function

%3CLINGO-SUB%20id%3D%22lingo-sub-1767411%22%20slang%3D%22en-US%22%3ERow%20dependent%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1767411%22%20slang%3D%22en-US%22%3E%3CP%3EWant%20to%20form%20a%20function%20that%20is%20row%20dependent.%3C%2FP%3E%3CP%3EFor%20given%20columns%20E%20%26amp%3B%20G%2C%20the%20following%20functions%20appear%20in%20cells%20G7%2C%20G8%20%26amp%3B%20G9%20%3A%3C%2FP%3E%3CP%3EG7%3DG6-E7%3C%2FP%3E%3CP%3EG8%3DG7-E8%3C%2FP%3E%3CP%3EG9%3DG8-E9%3C%2FP%3E%3CP%3EForm%20a%20general%20function%20of%20these%20equations%20so%20that%20there%20is%20no%20need%20to%20individually%20type%20in%20each%20equation%20for%20each%20cell.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1767411%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1767432%22%20slang%3D%22en-US%22%3ERe%3A%20Row%20dependent%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1767432%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F827420%22%20target%3D%22_blank%22%3E%40jomacapdb1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHow%20about%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DINDIRECT(ADDRESS(ROW()-1%2CCOLUMN()))%2BINDIRECT(ADDRESS(ROW()%2CCOLUMN()-2))%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1767964%22%20slang%3D%22en-US%22%3ERe%3A%20Row%20dependent%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1767964%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F827420%22%20target%3D%22_blank%22%3E%40jomacapdb1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENothing%20goes%20inside%20the%20brackets.%20ROW()%20returns%20the%20row%20number%20of%20the%20cell%20with%20the%20formula%2C%20and%20COLUMN()%20the%20column%20number%20of%20the%20cell%20with%20the%20formula.%3C%2FP%3E%0A%3CP%3ESelect%20the%20range%20into%20which%20you%20want%20the%20formulas%2C%20enter%20or%20copy%2Fpaste%20the%20formula%20from%20my%20previous%20reply%20and%20confirm%20it%20with%20Ctrl%2BEnter%20to%20enter%20it%20in%20all%20cells%20of%20the%20selection.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1768592%22%20slang%3D%22en-US%22%3ERe%3A%20Row%20dependent%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1768592%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3BStill%20require%20some%20more%20assistance%20before%20trying%20it%20out.%3C%2FP%3E%3CP%3E1.%20How%20%2F%20where%20do%20you%20select%20the%20range%20for%20this%20formula%3F%20I%20suppose%20that%20could%20be%20the%20start%20cell%20and%20the%20end%20cell%20of%20the%20column%20for%20this%20formula.%3C%2FP%3E%3CP%3E2.%20You%20say%20copy%20%2F%20paste%20the%20formula.%20But%20into%20which%20cell%2C%20or%20whereabouts%20on%20the%20spreadsheet%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1768595%22%20slang%3D%22en-US%22%3ERe%3A%20Row%20dependent%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1768595%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F827420%22%20target%3D%22_blank%22%3E%40jomacapdb1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20say%20that%20you%20want%20to%20apply%20the%20formula%20to%20G7%3AG100.%3C%2FP%3E%0A%3CP%3ESelect%20this%20range%20G7%3AG100.%3C%2FP%3E%0A%3CP%3EClick%20in%20the%20formula%20bar.%3C%2FP%3E%0A%3CP%3EIf%20there%20is%20already%20a%20formula%2C%20delete%20it.%3C%2FP%3E%0A%3CP%3EType%20the%20formula%20from%20my%20reply%20manually%2C%20or%20copy%20it%20from%20that%20reply%20and%20paste%20it%20into%20the%20formula%20bar.%3C%2FP%3E%0A%3CP%3EPress%20Ctrl%2BEnter.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1769044%22%20slang%3D%22en-US%22%3ERe%3A%20Row%20dependent%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1769044%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22lia-spoiler-container%22%3E%3CA%20class%3D%22lia-spoiler-link%22%20href%3D%22%23%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ESpoiler%3C%2FA%3E%3CNOSCRIPT%3E(Highlight%20to%20read)%3C%2FNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-border%22%3E%3CDIV%20class%3D%22lia-spoiler-content%22%3E%26nbsp%3B%3C%2FDIV%3E%3CNOSCRIPT%3E%3CDIV%20class%3D%22lia-spoiler-noscript-container%22%3E%3CDIV%20class%3D%22lia-spoiler-noscript-content%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FNOSCRIPT%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3BProgress%20of%20sorts.%20Instead%20of%20subtracting%20E%20values%20from%20G%20values%2C%20the%20resulting%20G%20values%20have%20the%20E%20values%20added%20to%20them.%20For%20example%2C%20G7%3DG6%2BE7%2C%20and%20not%20G7%3DG6-E7.%20Going%20down%20the%20G%20column%20results%20in%20increasing%20G%20values%2C%20whereas%20G%20needs%20to%20decrease%20in%20value.%20Over%20to%20you%20again.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Want to form a function that is row dependent.

For given columns E & G, the following functions appear in cells G7, G8 & G9 :

G7=G6-E7

G8=G7-E8

G9=G8-E9

Form a general function of these equations so that there is no need to individually type in each equation for each cell.

12 Replies
Highlighted

@jomacapdb1 

How about

 

=INDIRECT(ADDRESS(ROW()-1,COLUMN()))+INDIRECT(ADDRESS(ROW(),COLUMN()-2))

Highlighted

@Hans Vogelaar What goes inside the brackets? Does this formula need to be inserted into the relevant cell for each row? Not yet tried it out.

Highlighted

@jomacapdb1 

Nothing goes inside the brackets. ROW() returns the row number of the cell with the formula, and COLUMN() the column number of the cell with the formula.

Select the range into which you want the formulas, enter or copy/paste the formula from my previous reply and confirm it with Ctrl+Enter to enter it in all cells of the selection.

Highlighted

@Hans Vogelaar Still require some more assistance before trying it out.

1. How / where do you select the range for this formula? I suppose that could be the start cell and the end cell of the column for this formula.

2. You say copy / paste the formula. But into which cell, or whereabouts on the spreadsheet?

Highlighted

@jomacapdb1 

Let's say that you want to apply the formula to G7:G100.

Select this range G7:G100.

Click in the formula bar.

If there is already a formula, delete it.

Type the formula from my reply manually, or copy it from that reply and paste it into the formula bar.

Press Ctrl+Enter.

Highlighted
Spoiler
 

@Hans Vogelaar Progress of sorts. Instead of subtracting E values from G values, the resulting G values have the E values added to them. For example, G7=G6+E7, and not G7=G6-E7. Going down the G column results in increasing G values, whereas G needs to decrease in value. Over to you again.

Highlighted

@jomacapdb1 

Sorry about that. Change the formula to

=INDIRECT(ADDRESS(ROW()-1,COLUMN()))-INDIRECT(ADDRESS(ROW(),COLUMN()-2))
Highlighted

@Hans Vogelaar Minus instead of Plus, of course, I should have spotted that.

This is what happens at present. G values now decrease going down the G column.

But, I select a series of cells in the G column, say G7 to G20. I paste the formula into the formula bar. I click the tick symbol. The correct value appears in G7, but the remaining G8 to G20 cells are deselected, and do not show any decreasing values. If I select each cell individually, and click the formula in the formula bar, then each cell shows the correct value. But this is time consuming. I am looking to get the G values to appear simultaneously from a single click of the formula.

Highlighted

@jomacapdb1 

Hold down the Ctrl key when you click on the ✓ icon or press Enter.

Highlighted

@Hans Vogelaar Got it, instantaneous and simultaneous. Thank you for your assistance. As an aside, is this formula and procedure to be found somewhere else within Excel as a standard formula and procedure? Or did you produce it in order to answer my enquiry? If necessary, I would be interested to learn how to produce other non-standard formulae and procedures any time in the future.

Highlighted

@jomacapdb1 

The formula itself is specific for your request.

 

Ctrl+Enter to enter a formula in all cells of the selected range is a standard Excel shortcut. You can find it in (for example) Keyboard shortcuts in Excel 

 

By the way, this would also have worked:

  • Select G7:G100
  • Enter the formula =G6-E7
  • Press Ctrl+Enter
Highlighted

@Hans Vogelaar Thank you again for the info. Useful to know for future reference.