SOLVED

Restarting Formulas at Specified Data Points

%3CLINGO-SUB%20id%3D%22lingo-sub-2473213%22%20slang%3D%22en-US%22%3ERestarting%20Formulas%20at%20Specified%20Data%20Points%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2473213%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20very%20large%20data%20set%20and%20need%20to%20move%20all%20relevant%20data%20onto%20the%20same%20row%20to%20complete%20the%20analysis%20I%20am%20working%20on.%20After%20playing%20around%20with%20it%20for%20a%20while%2C%20I%20have%20been%20unable%20to%20find%20a%20way%20to%20get%20the%20equations%20to%20restart%20when%20they%20reach%20a%20set%20reference%20cell%20(see%20below).%20This%20is%20a%20two-part%20problem%2C%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CU%3EProblem%201%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20move%20everything%20in%20columns%20C%20and%20D%20to%20a%20single%20row%20(in%20this%20example%2C%20rows%202%2C%2011%2C%2016%20and%2030)%20and%20want%20the%20formula%20to%20reset%20every%20time%20it%20comes%20across%20a%20%E2%80%9C1%E2%80%9D%20reference%20(in%20this%20example%2C%20cells%20B2%2C%20B11%2C%20B16%2C%20B30)%2C%20as%20each%20customer%E2%80%99s%20data%20set%20varies%20in%20length.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rich_100_0-1624408757587.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F290586iA08B49254D8EE84A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rich_100_0-1624408757587.png%22%20alt%3D%22Rich_100_0-1624408757587.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rich_100_1-1624408757593.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F290587i40A9EF91AECEEE7D%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rich_100_1-1624408757593.png%22%20alt%3D%22Rich_100_1-1624408757593.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CU%3EProblem%202%20%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ESimilar%20to%20problem%201%2C%20I%20need%20the%20COUNTIF%20function%20to%20restart%20the%20equation%20every%20time%20it%20comes%20across%20a%20%E2%80%9C1%E2%80%9D%20reference%20(in%20this%20example%2C%20cells%20B2%2C%20B11%2C%20B16%2C%20B30)%2C%20as%2C%20again%2C%20each%20customer%E2%80%99s%20data%20set%20varies%20in%20length.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECurrent%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rich_100_2-1624408757602.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F290588i1C6C94EE11953969%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rich_100_2-1624408757602.png%22%20alt%3D%22Rich_100_2-1624408757602.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDesired%20Outcome%20(yellow%20cells%2C%20with%20all%20rows%20below%20appearing%20blank)%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rich_100_3-1624408757611.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F290589i6884011E3A12C3AD%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rich_100_3-1624408757611.png%22%20alt%3D%22Rich_100_3-1624408757611.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tried%20a%20bunch%20of%20different%20things%20and%20have%20hit%20a%20wall%2C%20so%20any%20help%20would%20be%20greatly%20appreciated!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdditionally%2C%20I%20am%20trying%20to%20complete%20this%20without%20VBA%20code%20at%20this%20stage%3B%20however%2C%20I%20am%20open%20to%20VBA%20or%20macros%20if%20the%20solution%20needs%20to%20go%20there.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CU%3EGeneral%20Information%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSTRONG%3EDevice%20platform%3A%3C%2FSTRONG%3E%20Windows%2010%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EExcel%20Version%3A%3C%2FSTRONG%3E%20Office%20365%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2473213%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2473536%22%20slang%3D%22en-US%22%3ERe%3A%20Restarting%20Formulas%20at%20Specified%20Data%20Points%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2473536%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1085557%22%20target%3D%22_blank%22%3E%40Rich_100%3C%2FA%3E%26nbsp%3BSince%20you%20begin%20by%20mentioning%20%22I%20have%20a%20very%20large%20data%20set%22%2C%20I'd%20suggest%20you%20look%20into%20Power%20Query%20(a.k.a.%20Get%20%26amp%3B%20Transform%20Data%20in%20MS365).%20But%20it%20would%20be%20helpful%20if%20you%20could%20upload%20a%20file%20containing%20some%20of%20your%20real%20data%20(replace%20any%20data%20that%20identifies%20real%20people%20or%20any%20other%20confidential%20information).%2015%20customers%20or%20so%20would%20do.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2477564%22%20slang%3D%22en-US%22%3ERe%3A%20Restarting%20Formulas%20at%20Specified%20Data%20Points%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2477564%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20getting%20back%20to%20me%20and%20suggesting%20the%20use%20of%20Power%20Query.%26nbsp%3B%26nbsp%3BI%E2%80%99m%20new%20to%20this%20feature%2C%20so%20just%20looking%20into%20how%20to%20use%20it%20now.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20had%20to%20sign%20an%20NDA%20with%20this%20client%2C%20so%20don't%20think%20I'll%20be%20able%20to%20use%20anyone%E2%80%99s%20real%20data.%20In%20place%20of%20this%2C%20I%20have%20drafted%20some%20dummy%20data%20in%20the%20same%20format.%20Would%20this%20be%20OK%20for%20what%20you%20need%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20confirm%2C%20the%20data%20set%20is%20a%20few%20hundred%20thousand%20cells%20and%20the%20yellow%20cells%20in%20the%20attached%20Excel%20workbook%20are%20for%20the%20data%20I%20am%26nbsp%3Bhoping%20to%20calculate%20in%20the%20following%20format%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EAge%20(column%20C)%20and%20gender%20(column%20D)%20%E2%80%93%20pull%20data%20from%20the%20corresponding%20columns%20to%20the%20top%20line%20for%20each%20client%3C%2FLI%3E%3CLI%3EActive%20member%20(column%20H)%3CUL%3E%3CLI%3EAn%20active%20member%20is%20someone%20who%20has%20paid%20their%20membership%20within%20the%20last%202%20months%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3EFor%20columns%20I%20%E2%80%93%20N%2C%20I%20just%20need%20to%20get%20a%20count%20of%20occurrences%20from%20the%20relevant%20columns%20for%20each%20client%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20any%20advice%20or%20guidance%20you%20can%20provide%2C%20it%E2%80%99s%20greatly%20appreciated%2C%20and%20please%20let%20me%20know%20if%20you%20have%20any%20questions%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%E2%80%99m%20going%20to%20have%20a%20play%20around%20with%20Power%20Query%20now%20and%20see%20if%20I%20can%20make%20any%20head%20way.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2477741%22%20slang%3D%22en-US%22%3ERe%3A%20Restarting%20Formulas%20at%20Specified%20Data%20Points%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2477741%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1085557%22%20target%3D%22_blank%22%3E%40Rich_100%3C%2FA%3E%26nbsp%3BThanks%20for%20uploading.%20Very%20helpful.%20Not%20able%20to%20look%20at%20this%20right%20now.%20Welcoming%20others%20to%20jump%20in.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2478101%22%20slang%3D%22en-US%22%3ERe%3A%20Restarting%20Formulas%20at%20Specified%20Data%20Points%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2478101%22%20slang%3D%22en-US%22%3EAll%20good%2C%20thanks.%20I%20need%20to%20deliver%20this%20work%20to%20the%20client%20by%20Monday%2028th%20of%20June%2C%20so%20will%20continue%20to%20play%20around%20with%20Power%20Query%20and%20see%20where%20I%20get%20to.%20Any%20input%2C%20tips%20and%20tricks%20are%20definitely%20welcome!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2479608%22%20slang%3D%22en-US%22%3ERe%3A%20Restarting%20Formulas%20at%20Specified%20Data%20Points%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2479608%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1085557%22%20target%3D%22_blank%22%3E%40Rich_100%3C%2FA%3E%26nbsp%3BForgive%20me%20for%20challenging%20your%20reporting%20request%2C%20but%20perhaps%20you%20could%20consider%20a%20more%20condensed%20approach.%20Rather%20than%20creating%20a%20large%2C%20rather%20unstructured%2C%20list%20with%20sub%20totals%20of%20some%20kind%2C%20why%20not%20create%20one%20ore%20more%20reports%20on%20the%20bases%20of%20cleaned%20and%20unpivoted%20data.%20A%20rough%20example%20is%20included%20in%20the%20attached%20workbook.%20I%20chose%20to%20load%20an%20intermediate%20table%20into%20Excel%2C%20just%20to%20demonstrate.%20In%20reality%2C%20you%20would%20probably%20load%20it%20into%20the%20Data%20Model%20and%20work%20from%20there.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

 

I have a very large data set and need to move all relevant data onto the same row to complete the analysis I am working on. After playing around with it for a while, I have been unable to find a way to get the equations to restart when they reach a set reference cell (see below). This is a two-part problem, as follows:

 

Problem 1

I am trying to move everything in columns C and D to a single row (in this example, rows 2, 11, 16 and 30) and want the formula to reset every time it comes across a “1” reference (in this example, cells B2, B11, B16, B30), as each customer’s data set varies in length.

 

Rich_100_0-1624408757587.png

 

Rich_100_1-1624408757593.png

 

 

Problem 2

Similar to problem 1, I need the COUNTIF function to restart the equation every time it comes across a “1” reference (in this example, cells B2, B11, B16, B30), as, again, each customer’s data set varies in length.

 

Current

Rich_100_2-1624408757602.png

 

Desired Outcome (yellow cells, with all rows below appearing blank)

Rich_100_3-1624408757611.png

 

I have tried a bunch of different things and have hit a wall, so any help would be greatly appreciated!

 

Additionally, I am trying to complete this without VBA code at this stage; however, I am open to VBA or macros if the solution needs to go there.

 

General Information

  • Device platform: Windows 10
  • Excel Version: Office 365

 

Thanks in advance!

11 Replies

@Rich_100 Since you begin by mentioning "I have a very large data set", I'd suggest you look into Power Query (a.k.a. Get & Transform Data in MS365). But it would be helpful if you could upload a file containing some of your real data (replace any data that identifies real people or any other confidential information). 15 customers or so would do.

Hi @Riny_van_Eekelen,

 

Thanks for getting back to me and suggesting the use of Power Query.  I’m new to this feature, so just looking into how to use it now. 

 

I've had to sign an NDA with this client, so don't think I'll be able to use anyone’s real data. In place of this, I have drafted some dummy data in the same format. Would this be OK for what you need?

 

To confirm, the data set is a few hundred thousand cells and the yellow cells in the attached Excel workbook are for the data I am hoping to calculate in the following format:

 

  • Age (column C) and gender (column D) – pull data from the corresponding columns to the top line for each client
  • Active member (column H)
    • An active member is someone who has paid their membership within the last 2 months
  • For columns I – N, I just need to get a count of occurrences from the relevant columns for each client

 

Thank you for any advice or guidance you can provide, it’s greatly appreciated, and please let me know if you have any questions?

 

I’m going to have a play around with Power Query now and see if I can make any head way.

 

@Rich_100 Thanks for uploading. Very helpful. Not able to look at this right now. Welcoming others to jump in.

All good, thanks. I need to deliver this work to the client by Monday 28th of June, so will continue to play around with Power Query and see where I get to. Any input, tips and tricks are definitely welcome!

@Rich_100 Forgive me for challenging your reporting request, but perhaps you could consider a more condensed approach. Rather than creating a large, rather unstructured, list with sub totals of some kind, why not create one ore more reports on the bases of cleaned and unpivoted data. A rough example is included in the attached workbook. I chose to load an intermediate table into Excel, just to demonstrate. In reality, you would probably load it into the Data Model and work from there.

 

Thanks for the response @Riny_van_Eekelen, the data looks great! I’ve been asked to help on a project, which is outside of my usual area of expertise, so any advice or recommendations for the most efficient way to sort and display this data is definitely welcome.

Currently, I am learning Power Query as I go, which is a fairly steep learning curve. I’ve tried to reverse engineer what you’ve done, and made some head way, but can’t seem to get my outputs to look as clean as yours. Would you mind detailing your steps please?
best response confirmed by Rich_100 (Occasional Contributor)
Solution

@Rich_100 Okay, let's give it a try. You can follow the applied steps in my file. No need to reverse engineer them. But, ignore the query "Table1". I forgot to delete it.

 

Step 1 was to create a separate table with just the Customer, Age and Gender.

 

Step 2 is to go back to the same source (Query "Table1 (2)". Remove some unwanted columns. Then merge the query from step 1 with the cleaned-up table in step 2. This will add the Age and Gender to each Customer record. Reorder columns and then, probably the most important step is to select the customer, age and gender columns and then select to "unpivot other columns", Then you get a long list of "records" from which you can filter out the date fields. 

Now you can merge the "Attribute" and "Value" columns, separated by a colon. Close and load to a table, to create the output that you see in columns M:P. 

 

Step 3 is to create pivot table from that table (i.e. the end result from Step 2) in order to  give you the condensed view per customer.

 

As you noticed, PQ has quite a steep learning curve. But once you get over the first hurdles, you'll love it. Good luck!

Perfect, thank you @Riny_van_Eekelen!

 

Apologies if this is a silly question, but how have you got the pivot table into the format where it is showing the age and gender on the same row, as I can only get it to display as seen in the attached document?

@Rich_100 Click anywhere inside the pivot table. On the "Design" ribbon, select "Report layout". First select "Show in tabular form" and then "Repeat all item labels". Still in the Design tab, select the "Subtotals" button and check "Don't show subtotals". 

 

Perfect, thanks! You're an absolute life saver @Riny_van_Eekelen. Thank you for all the help and taking the time, it's greatly appreciated!

 

@Rich_100 Most welcome!