Formula LOOKUP(9.999E+307,C65:O65)

jevi

Active Member
Joined
Apr 13, 2010
Messages
339
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I know this old formula long time ago =LOOKUP(9.999E+307,C65:O65)-F65

I have 12 columns for the 12 months from January to Dicember and then I have a column when I do the Difference between last month and the previous month. So in order not to change every months the cells I came up with this formula which LOOKUP(9.999E+307,C65:O65) gaves me the last month value entered in column but I don't know how to do auotmatically put then the previous month (F65).

So if I have put the date of April I would like to have April - March and so on for the next Month May (LOOKUP(9.999E+307,C65:O65 - this formula will give me the data of May) - April (but I don't know how to say the previous month in the formula).

I hope I was clear enough:).

Thank you,
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Assuming you fill all cells up to and including the most recent month, and the months beyond that are empty, you could do it this way:
Book2.xlsm
ABCDEFGHIJKLM
1JanFebMarAprMayJunJulAugSepOctNovDecDiff Last 2
2878317597011
Sheet6
Cell Formulas
RangeFormula
M2M2=INDEX($A$1:$L$2,2,COUNT($A$2:$L$2))-INDEX($A$1:$L$2,2,COUNT($A$2:$L$2)-1)
 
Upvote 0
It worked great just to make sure I did understand it well so if I want to continue as I have other rows of data as I have branches in different rows with data so it woul be
M3= INDEX($A$1:$L$3,3,COUNT($A$3:$L$3))-INDEX($A$1:$L$3,3,COUNT($A$3:$L$3)-1)
M4= INDEX($A$2:$L$4,3,COUNT($A$4:$L$4))-INDEX($A$2:$L$4,3,COUNT($A$4:$L$4)-1)
and so on......and it works but I don't understand why it works with 3 as row and not if I use 4 or etc...it works only with 3. Maybe it is too late :).

Thank you so much.
 
Upvote 0
You are welcome - thanks for the reply. I didn't know you have more than 1 row of data. In that case it will be easier to enter this formula in M2 and then just copy it down to cover your additional rows.

=INDEX($A2:$L2,1,COUNT($A2:$L2))-INDEX($A2:$L22,1,COUNT($A2:$L2)-1)
 
Upvote 0
Hi, JoeMo's formula will work well for your case, but please change L22 to L2 in the second INDEX.
Here is another formula just for your reference in case there is no blank cells for any months.
MrExcel.xlsx
ABCDEFGHIJKLM
1JanFebMarAprMayJunJulAugSepOctNovDecDiff Last 2
2878317597011
387831759708414
Sheet3
Cell Formulas
RangeFormula
M2:M3M2=SUM(INDEX(A2:L2,COUNTA(A2:L2)-{0,1})*{1,-1})
 
Upvote 0
Thank you JoeMo, it worked as a treat and sorry it was my fault that I did't tell I had other rows:).

I will keep that in mind Shaowu so I wrote it down in my file as for sure I will need it someday. I love formulas but I am not that good as you and JoeMo so is beautiful when you see what you can do with them and how much time and boring work I can save:).
 
Upvote 0
for the next Month May (LOOKUP(9.999E+307,C65:O65 - this formula will give me the data of May) - April (but I don't know how to say the previous month in the formula).
If you wanted to continue with that LOOKUP(9.99... function, you could try this also

BTW, I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

20 06 17.xlsm
ABCDEFGHIJKLM
1JanFebMarAprMayJunJulAugSepOctNovDecDiff Last 2
2878317597011
387831759708414
Sheet2 (2)
Cell Formulas
RangeFormula
M2:M3M2=LOOKUP(9.999E+307,B2:L2)-LOOKUP(9.999E+307,B2:L2,A2:K2)
 
Upvote 0
Thank you Peter for the formula, really great to know all the options :).

I did update my information. Thank you for the advice.
 
Upvote 0
You're welcome, and thanks for updating your profile. (y)
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top