How to find the first and last non blank cells in a row, then pull the column names (month/year) to get first seen and last seen

jholly1984

New Member
Joined
Sep 29, 2020
Messages
15
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
Hi everyone.

I am a beginner with excel and could use some formula help if possible.

I am working on a document that tracks website trafffic by month for 5 years (each month is a column).

Some sites have no traffic for some of the months.

What i need to do is have the ability to pull in the FIRST and LAST non blank cell in a given row... then pull the column name (month/year) as the value.

The goal is to be able to say this site was first seen on {Month/Year) and Last Seen (Month/Year).

In some cases its a straight line... a site starts in a given month and dies at a specific time later.

In other cases a site is smaller and could have blanks in the middle of the data set... not just the beginning and end.

So i need a formula that only pulls the first month where a traffic number exists and the last month where traffic exists.

I was able to find one formula that seems to work that pulls in the actual traffic value for the first non blank cell in a row... but I actually need the column name as the output.. not the cell value itself.

=INDEX($B$2:$BE$2,SMALL(IF($B$2:$BE$2<>"",COLUMN($B$2:$BE$2)-COLUMN($B$2)+1),1))

I have been unable to find a similar formula for finding the last non-blank cell in a row.

Any help would be greatly appreciated. Thank you SO MUCH for your time.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
each month is a column
I'm assuming those column headings are actual dates (but perhaps formatted to show month/year only)?

You would have to adjust the ranges for 5 years but see if this could help.

BTW, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.

23 01 14.xlsm
ABCDEFGHIJKLMNOP
1FirstLast1/01/20221/02/20221/03/20221/04/20221/05/20221/06/20221/07/20221/08/20221/09/20221/10/20221/11/20221/12/2022
2Site 103/202206/2022xxxx
3Site 2  
4Site 308/202208/2022x
5Site 402/202210/2022xxxxx
First Last
Cell Formulas
RangeFormula
B2:B5B2=IFERROR(AGGREGATE(15,6,E$1:P$1/(E2:P2<>""),1),"")
C2:C5C2=IF(B2="","",AGGREGATE(14,6,E$1:P$1/(E2:P2<>""),1))
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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