SOLVED

How to Reference the Last Cell in a Column in a Table?

%3CLINGO-SUB%20id%3D%22lingo-sub-1722598%22%20slang%3D%22en-US%22%3EHow%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1722598%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SheetOnePic.jpg%22%20style%3D%22width%3A%20720px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F222685iD6A55674B781AECF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22SheetOnePic.jpg%22%20alt%3D%22Sheet%20One%20with%20Table%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ESheet%20One%20with%20Table%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SheetTwoPic.jpg%22%20style%3D%22width%3A%20382px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F222686iD4EC1E3D9411211D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22SheetTwoPic.jpg%22%20alt%3D%22Sheet%20Two%20Referencing%20Prior%20Table%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ESheet%20Two%20Referencing%20Prior%20Table%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20table%20where%20I%20add%20data%20at%20the%20end%20of%20every%20day.%20I%20would%20like%20a%20formula%20to%20reference%20the%20last%20value%20in%20a%20column.%20Is%20there%20an%20easy%20way%20to%20do%20that%3F%20In%20the%20photos%20above%2C%20I%20would%20like%20B5%20on%20Sheet2%20to%20reference%20the%20value%20in%20E14%20on%20Sheet1%2C%20which%20is%20the%20last%20value%20in%20KeyThree%20column.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20not%20well%20versed%20in%20commands%20for%20tables.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAside%20from%20specific%20table%20commands%2C%20by%20knowing%20the%20count%2C%20I%20could%20use%20index%20or%20offset%20to%20reference%20the%20appropriate%20cell.%20But%20I%20am%20curious%20if%20there%20is%20a%20more%20elegant%20solution%20where%20I%20don't%20have%20to%20keep%20track%20of%20the%20count.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20uploaded%20this%20simple%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20look%20forward%20to%20your%20comments.%20Thank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1722598%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1722689%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1722689%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F549380%22%20target%3D%22_blank%22%3E%40KStecyk%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOne%20option%3A%3C%2FP%3E%3CP%3E%3DLOOKUP(1%2C1%2F(KeyTable%5BKeyThree%5D%26lt%3B%26gt%3B%22%22)%2CKeyTable%5BKeyThree%5D)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1722693%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1722693%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F549380%22%20target%3D%22_blank%22%3E%40KStecyk%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20believe%20this%20is%20one%20option%20that%20should%20work%3A%3C%2FP%3E%3CP%3E%3DLOOKUP(2%2C1%2F(KeyTable%5BKeyThree%5D%26lt%3B%26gt%3B%22%22)%2CKeyTable%5BKeyThree%5D)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1722711%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1722711%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F549380%22%20target%3D%22_blank%22%3E%40KStecyk%3C%2FA%3E%26nbsp%3BAs%20a%20variant%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DINDEX(KeyTable%5BKeyThree%5D%2CMATCH(99%5E99%2CKeyTable%5BKeyThree%5D))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726311%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726311%22%20slang%3D%22en-US%22%3EThank%20you%2C%20JMB17%2C%20for%20your%20reply.%20It%20helped%20me%20to%20create%20my%20own%20formula%2C%20which%20I%20will%20show%20in%20the%20next%20reply.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726316%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726316%22%20slang%3D%22en-US%22%3EThank%20you%20for%20your%20reply.%20I%20looked%20at%20your%20and%20JMB17's%20reply%20to%20create%20me%20own.%3CBR%20%2F%3E%3CBR%20%2F%3EInitially%2C%20I%20mentioned%20about%20the%20count.%20I%20did%20not%20want%20to%20have%20to%20manually%20keep%20track%20of%20the%20count%2C%20but%20I%20can%20use%20the%20count%20function%20to%20help%20me.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20am%20not%20sure%20how%20to%20show%20code%2C%20but%20my%20formula%20is%20as%20follows%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%60%20%3DINDEX(KeyTable%5BKeyThree%5D%2C%20COUNT(KeyTable%5BKeyThree%5D))%3CBR%20%2F%3E%3CBR%20%2F%3EIt's%20really%20just%20a%20hybrid%20of%20the%20two%20prior%20ideas.%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%20for%20helping%20me%20with%20this%20small%20problem.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726517%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726517%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F549380%22%20target%3D%22_blank%22%3E%40KStecyk%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20variant%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DINDEX(KeyTable%5BKeyThree%5D%2CXMATCH(%2CKeyTable%5BKeyThree%5D)-1)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726943%22%20slang%3D%22en-US%22%3ERE%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726943%22%20slang%3D%22en-US%22%3EI'm%20using%20Power%20Query%20on%20Excel%20for%20Mac.%20I%20save%20my%20%22iqy%22%20file%20to%20a%20Queries%20Folder%2C%20but%20then%20when%20I%20go%20to%20to%20Excel%20and%20go%20to%20Data%2FGet%20External%20Data%2FRun%20Web%20Query%2C%20my%20%22iqy%22%20files%20are%20all%20greyed%20out%2C%20except%20for%20the%20sample%20files%20from%20MS%20which%20are%20not%20greyed%20out.%20Does%20anyone%20know%20why%20my%20files%20would%20be%20greyed%20out%20and%20how%20to%20change%20that.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726946%22%20slang%3D%22en-US%22%3ERE%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726946%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F800654%22%20target%3D%22_blank%22%3E%40800654%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ERather%20than%20hijacking%20this%20thread%20with%20your%20different%20topic%2C%20you'll%20likely%20get%20more%20success%20with%20your%20own%20separate%20thread.%20That%20way%2C%20people%20can%20see%20and%20focus%20on%20your%20specific%20question.%20If%20they%20read%20my%20question%2C%20they%20might%20not%20even%20bother%20to%20read%20further.%3CBR%20%2F%3E%3CBR%20%2F%3EGood%20luck.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726947%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726947%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F549380%22%20target%3D%22_blank%22%3E%40KStecyk%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELike%20the%20INDEX%2FMATCH%20this%20will%20return%20a%20single-cell%20range%20reference%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20LET(%0A%20%20field%2C%20KeyTable%5BKeyThree%5D%2C%0A%20%20XLOOKUP(1%2C%20SIGN(field)%2C%20field%2C%2C%2C-1)%20)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThe%20LOOKUP%20formula%20would%20do%20fine%20to%20return%20the%20value.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726967%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726967%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%2C%20please%2C%20explain%20your%20formula%3F%20When%20I%20look%20at%20the%20XMATCH%20function%2C%20I%20notice%20that%20the%20first%20argument%20is%20required.%20Yet%20you%20seemed%20to%20have%20skipped%20the%20first%20argument.%20I'd%20appreciate%20knowing%20how%20your%20formula%20works.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DINDEX(KeyTable%5BKeyThree%5D%2CXMATCH(%2CKeyTable%5BKeyThree%5D)-1)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBelow%20is%20a%20link%20to%20the%20XMATCH%20function.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Fxmatch-function-d966da31-7a6b-4a13-a1c6-5a33ed6a0312%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Foffice%2Fxmatch-function-d966da31-7a6b-4a13-a1c6-5a33ed6a0312%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1726974%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1726974%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%2C%20Peter%2C%20for%20your%20response.%20While%20I%20am%20confident%20that%20your%20solution%20works%20mighty%20fine%2C%20it%20looks%20complicated%20to%20me.%20I%20am%20okay%20with%20the%20Let%20function%2C%20but%20the%20XLOOKUP%20with%20all%20the%20different%20arguments%20seems%20complicated.%20Even%20so%2C%20it%20is%20good%20to%20see%20different%20alternatives.%20Sometimes%2C%20though%2C%20it%20is%20good%20to%20do%20things%20differently.%20So%20I%20appreciate%20your%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1727032%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1727032%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20the%20following%20formula%20in%20an%20attempt%20to%20understand%20what%20you%20did%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DXMATCH(%2CKeyTable%5BKeyThree%5D)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20got%20an%20answer%20of%2013%2C%20which%20is%20one%20more%20than%20the%20number%20of%20filled%20rows.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20tried%20the%20following%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DXMATCH(%22*%22%2CKeyTable%5BKeyThree%5D)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20got%20%23N%2FA%20for%20an%20answer.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20guessing%20that%20when%20you%20skip%20the%20first%20argument%2C%20XLOOKUP%20looks%20for%20any%20value%2C%20similar%20to%20a%20wildcard.%20But%20I%20got%20a%20value%20of%201%20greater%20than%20the%20number%20of%20data%20rows.%20So%20I%20am%20puzzled.%20I%20am%20also%20puzzled%20why%20a%20wildcard%20failed.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%2C%20please%2C%20elaborate%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKevin%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1727503%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1727503%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F549380%22%20target%3D%22_blank%22%3E%40KStecyk%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hadn't%20realised%20that%20you%20could%20simply%20omit%20the%20lookup%20value%20but%20it%20appears%20to%20work%20as%20a%20search%20for%20the%20first%20blank%20cell%2C%20hence%20the%20index%20returned%20is%201%20larger%20than%20the%20last%20occupied%20cell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20make%20your%20search%20for%20the%20last%20cell%20work%2C%20several%20changes%20are%20needed%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20INDEX(%20KeyTable%5BKeyThree%5D%2C%20%0A%20%20XMATCH(%20%22*%22%2C%20KeyTable%5BKeyThree%5D%2C%202%2C%20-1)%20)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EFirstly%2C%20the%20table%20would%20need%20to%20be%20text%20and%20not%20numeric.%26nbsp%3B%20By%20default%2C%20XMATCH%20performs%20an%20exact%20match%20without%20wildcards%20so%20the%20parameter%20value%202%20is%20required.%26nbsp%3B%20Finally%2C%20you%20require%20the%20last%20match%2C%20not%20the%20first%2C%20so%20the%20-1%20is%20used.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20use%20of%20SIGN%20within%20XLOOKUP%20causes%20it%20to%20return%20the%20last%20positive%20number%3B%20text%2C%20zeros%20and%20even%20negative%20numbers%20would%20be%20ignored.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20agree%20that%20my%20using%20LET%20is%20unnecessarily%20verbose%2C%20especially%20since%20the%20structured%20references%20to%20the%20table%20already%20convey%20meaning.%26nbsp%3B%20I%20suspect%20that%20it%20is%20also%20a%20matter%20of%20what%20one%20gets%20used%20to.%26nbsp%3B%20If%20all%20the%20formulae%20in%20the%20workbook%20use%20LET%20to%20provide%20a%20level%20of%20self-documentation%2C%20then%20it%20would%20no%20longer%20be%20seen%20as%20complicated.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1727698%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Reference%20the%20Last%20Cell%20in%20a%20Column%20in%20a%20Table%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1727698%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F549380%22%20target%3D%22_blank%22%3E%40KStecyk%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20'novelty'%20workbook%20loosely%20based%20on%20your%20question.%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20918px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F222995iAB85CE64A48054A4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Sheet One with TableSheet One with TableSheet Two Referencing Prior TableSheet Two Referencing Prior Table

 

I have a table where I add data at the end of every day. I would like a formula to reference the last value in a column. Is there an easy way to do that? In the photos above, I would like B5 on Sheet2 to reference the value in E14 on Sheet1, which is the last value in KeyThree column.

 

I am not well versed in commands for tables. 

 

Aside from specific table commands, by knowing the count, I could use index or offset to reference the appropriate cell. But I am curious if there is a more elegant solution where I don't have to keep track of the count.

 

I have uploaded this simple spreadsheet.

 

I look forward to your comments. Thank you.

24 Replies

@KStecyk 

 

I believe this is one option that should work:

=LOOKUP(2,1/(KeyTable[KeyThree]<>""),KeyTable[KeyThree])

@KStecyk As a variant:

 

=INDEX(KeyTable[KeyThree],MATCH(99^99,KeyTable[KeyThree]))

 

Thank you, JMB17, for your reply. It helped me to create my own formula, which I will show in the next reply.
Best Response confirmed by KStecyk (Contributor)
Solution
Thank you for your reply. I looked at your and JMB17's reply to create me own.

Initially, I mentioned about the count. I did not want to have to manually keep track of the count, but I can use the count function to help me.

I am not sure how to show code, but my formula is as follows:

` =INDEX(KeyTable[KeyThree], COUNT(KeyTable[KeyThree]))

It's really just a hybrid of the two prior ideas.

Thank you for helping me with this small problem.

@KStecyk 

As variant

=INDEX(KeyTable[KeyThree],XMATCH(,KeyTable[KeyThree])-1)
I'm using Power Query on Excel for Mac. I save my "iqy" file to a Queries Folder, but then when I go to to Excel and go to Data/Get External Data/Run Web Query, my "iqy" files are all greyed out, except for the sample files from MS which are not greyed out. Does anyone know why my files would be greyed out and how to change that.

@Deleted

Rather than hijacking this thread with your different topic, you'll likely get more success with your own separate thread. That way, people can see and focus on your specific question. If they read my question, they might not even bother to read further.

Good luck.

@KStecyk 

Like the INDEX/MATCH this will return a single-cell range reference

= LET(
  field, KeyTable[KeyThree],
  XLOOKUP(1, SIGN(field), field,,,-1) )

The LOOKUP formula would do fine to return the value.

@Sergei Baklan 

 

Can you, please, explain your formula? When I look at the XMATCH function, I notice that the first argument is required. Yet you seemed to have skipped the first argument. I'd appreciate knowing how your formula works.

 

=INDEX(KeyTable[KeyThree],XMATCH(,KeyTable[KeyThree])-1)

 

Below is a link to the XMATCH function.

 

https://support.microsoft.com/en-us/office/xmatch-function-d966da31-7a6b-4a13-a1c6-5a33ed6a0312

@Peter Bartholomew 

 

Thank you, Peter, for your response. While I am confident that your solution works mighty fine, it looks complicated to me. I am okay with the Let function, but the XLOOKUP with all the different arguments seems complicated. Even so, it is good to see different alternatives. Sometimes, though, it is good to do things differently. So I appreciate your help.

@Sergei Baklan 

 

I tried the following formula in an attempt to understand what you did:

 

=XMATCH(,KeyTable[KeyThree])

 

I got an answer of 13, which is one more than the number of filled rows. 

 

I also tried the following:

=XMATCH("*",KeyTable[KeyThree])

 

I got #N/A for an answer. 

 

I am guessing that when you skip the first argument, XLOOKUP looks for any value, similar to a wildcard. But I got a value of 1 greater than the number of data rows. So I am puzzled. I am also puzzled why a wildcard failed. 

 

Can you, please, elaborate?

 

Kevin

 

@KStecyk 

I hadn't realised that you could simply omit the lookup value but it appears to work as a search for the first blank cell, hence the index returned is 1 larger than the last occupied cell.

 

To make your search for the last cell work, several changes are needed

= INDEX( KeyTable[KeyThree], 
  XMATCH( "*", KeyTable[KeyThree], 2, -1) )

Firstly, the table would need to be text and not numeric.  By default, XMATCH performs an exact match without wildcards so the parameter value 2 is required.  Finally, you require the last match, not the first, so the -1 is used.

 

My use of SIGN within XLOOKUP causes it to return the last positive number; text, zeros and even negative numbers would be ignored.

 

I agree that my using LET is unnecessarily verbose, especially since the structured references to the table already convey meaning.  I suspect that it is also a matter of what one gets used to.  If all the formulae in the workbook use LET to provide a level of self-documentation, then it would no longer be seen as complicated.  

 

 

@KStecyk 

A 'novelty' workbook loosely based on your question.image.png

@Peter Bartholomew 


I hadn't realised that you could simply omit the lookup value but it appears to work as a search for the first blank cell, hence the index returned is 1 larger than the last occupied cell.

 

I had to remove the rest of your post from the quote because I system wouldn't post it. There was a hiccup with html or something.

 

Thank you, Peter, for your excellent explanations. Now, I understand why XMATCH works with the first argument missing. And thank you for the explanation on using the wildcard search. I understand your comments.

@Peter Bartholomew 

I very much appreciate the time you've taken to create a novelty spreadsheet. I am learning from you.

 

I found your formulas break if the last value is negative. That is, the formula gives the wrong answer. I tried to create a formula to address this weakness, but my formula doesn't work. I am hoping you can spot my error and fix.

 

PeterSpreadsheetPic.jpg

 

I have included a version 2 of your spreadsheet. 

 

I look forward to your response. 

 

Kevin

@Peter Bartholomew 

 

I solved my own problem. I had a typo because I copied the wrong formula. If you open the enclosed spreadsheets, you'll see.

 

PeterSpreadsheetPic2.jpg

 

I will also enclose version 2a of the spreadsheet. 

 

Thank you!

 

Kevin

@KStecyk 

What you are doing is perfectly correct.  From the original example, I was guessing how you wanted to treat text, zeros, negative numbers, Booleans, Errors.

I would also note that the formula at the foot of the table could be simplified by taking advantage of relative structured referencing, but that does not apply to the lookup from sheet 2 or the conditional formatting.

= LET(
  header, KeyTable[#Headers],
  field,  KeyTable[KeyTwo],
  XLOOKUP(TRUE, ISNUMBER(field), field,"empty",,-1))

 

@KStecyk 

Hi there,

I hope the following formula will help you to find last cell value in a Column in a Table.

 

=LOOKUP(3, 1/(KeyTable[KeyOne]<>""),KeyTable[KeyOne])

@KStecyk , both XMATCH and XLOOKUP accept blank as value for the lookup. You may use reference on any blank cell or skip first argument, that is interpreted as blank value. Result will be the same.